it.could.util.location
Class Parameters.Parameter

java.lang.Object
  extended byit.could.util.location.Parameters.Parameter
All Implemented Interfaces:
Encodable, EncodingAware
Enclosing class:
Parameters

public static class Parameters.Parameter
extends Object
implements Encodable

The Parameter class represents a single parameter either parsed from a query string or a path element.

Author:
Pier Fumagalli

Field Summary
 
Fields inherited from interface it.could.util.encoding.EncodingAware
DEFAULT_ENCODING, PLATFORM_ENCODING
 
Constructor Summary
Parameters.Parameter(String name, String value)
          Create a new Parameter given an encoded parameter name and value.
 
Method Summary
 boolean equals(Object object)
          Check if the specified Object is equal to this Parameter instance.
 String getName()
          Return the URL-decoded name of this Parameter instance.
 String getValue()
          Return the URL-decoded value of this Parameter instance.
 int hashCode()
          Return the hash code value for this Parameter instance.
static Parameters.Parameter parse(String parameter)
          Parse the specified parameters String into a Parameters.Parameter instance.
static Parameters.Parameter parse(String parameter, String encoding)
          Parse the specified parameters String into a Parameters.Parameter instance.
 String toString()
          Return the URL-encoded String representation of this Parameter instance.
 String toString(String encoding)
          Return the URL-encoded String representation of this Parameter instance using the specified character encoding.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Parameters.Parameter

public Parameters.Parameter(String name,
                            String value)

Create a new Parameter given an encoded parameter name and value.

Throws:
NullPointerException - if the name was null.
IllegalArgumentException - if the name was an empty string.
Method Detail

parse

public static Parameters.Parameter parse(String parameter)
                                  throws UnsupportedEncodingException

Parse the specified parameters String into a Parameters.Parameter instance.

Returns:
a non-null and not empty Parameters.Parameter instance or null if the specified string was null or empty.
Throws:
UnsupportedEncodingException

parse

public static Parameters.Parameter parse(String parameter,
                                         String encoding)
                                  throws UnsupportedEncodingException

Parse the specified parameters String into a Parameters.Parameter instance.

Returns:
a non-null and not empty Parameters.Parameter instance or null if the specified string was null or empty.
Throws:
UnsupportedEncodingException

getName

public String getName()

Return the URL-decoded name of this Parameter instance.


getValue

public String getValue()

Return the URL-decoded value of this Parameter instance.


toString

public String toString()

Return the URL-encoded String representation of this Parameter instance.

Specified by:
toString in interface Encodable

toString

public String toString(String encoding)
                throws UnsupportedEncodingException

Return the URL-encoded String representation of this Parameter instance using the specified character encoding.

Specified by:
toString in interface Encodable
Throws:
UnsupportedEncodingException - if the specified encoding is not supported by the platform.

hashCode

public int hashCode()

Return the hash code value for this Parameter instance.


equals

public boolean equals(Object object)

Check if the specified Object is equal to this Parameter instance.

The specified Object is considered equal to this one if it is non-null, it is a Parameter instance, and its string representation equals this one's.