|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
it.could.util.location.Parameters
The Parameters
class represents a never empty and
immutable List
of Parameter
instances,
normally created parsing a query string.
Nested Class Summary | |
static class |
Parameters.Parameter
The Parameter class represents a single
parameter either parsed from a query string or a path element. |
Field Summary | |
static char |
DEFAULT_DELIMITER
The default delimiter for a Parameters instance. |
Fields inherited from class java.util.AbstractList |
modCount |
Fields inherited from interface it.could.util.encoding.EncodingAware |
DEFAULT_ENCODING, PLATFORM_ENCODING |
Constructor Summary | |
Parameters(List parameters)
Create a new Parameters instance from
a List of Parameter instances
using the default parameter delimiter . |
|
Parameters(List parameters,
char delimiter)
Create a new Parameters instance from
a List of Parameter instances
using the specified character as the parameters delimiter. |
Method Summary | |
static Parameters |
create(List parameters)
Utility method to create a new Parameters instance from a
List of Parameter instances. |
static Parameters |
create(List parameters,
char delimiter)
Utility method to create a new Parameters instance from a
List of Parameter instances. |
boolean |
equals(Object object)
Check if the specified Object is equal to this
Parameters instance. |
Object |
get(int index)
Return the Parameter stored by this\
instance at the specified index. |
Set |
getNames()
Return an immutable Set of String s containing all
known Parameter
names . |
String |
getValue(String name)
Return the first String value associated with the
specified parameter name, or null. |
List |
getValues(String name)
Return an immutable List of all String values
associated with the specified parameter name, or null. |
int |
hashCode()
Return the hash code value of this Parameters instance. |
static Parameters |
parse(String parameters)
Parse the specified parameters String into a
Parameters instance using the default
parameter delimiter . |
static Parameters |
parse(String parameters,
char delimiter)
Parse the specified parameters String into a
Parameters instance using the specified character as the
parameters delimiter. |
static Parameters |
parse(String parameters,
char delimiter,
String encoding)
Parse the specified parameters String into a
Parameters instance using the specified character as the
parameters delimiter. |
static Parameters |
parse(String parameters,
String encoding)
Parse the specified parameters String into a
Parameters instance using the default
parameter delimiter . |
int |
size()
Return the number of Parameter s
contained by this instance. |
String |
toString()
Return the URL-encoded String representation of this
Parameters instance. |
String |
toString(String encoding)
Return the URL-encoded String representation of this
Parameters instance using the specified
character encoding. |
Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
Methods inherited from class java.util.AbstractCollection |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Field Detail |
public static final char DEFAULT_DELIMITER
The default delimiter for a Parameters
instance.
Constructor Detail |
public Parameters(List parameters)
Create a new Parameters
instance from
a List
of Parameter
instances
using the default parameter delimiter
.
NullPointerExceptoin
- if the List
was null.
IllegalArgumentException
- if the List
was empty.
ClassCastException
- if any of the elements in the List
was
not a Parameter
.public Parameters(List parameters, char delimiter)
Create a new Parameters
instance from
a List
of Parameter
instances
using the specified character as the parameters delimiter.
NullPointerExceptoin
- if the List
was null.
IllegalArgumentException
- if the List
was empty.
ClassCastException
- if any of the elements in the List
was
not a Parameter
.Method Detail |
public static Parameters create(List parameters)
Utility method to create a new Parameters
instance from a
List
of Parameter
instances.
Parameters
instance or
null if the specified List
was null, empty
or did not contain any Parameter
.
ClassCastException
- if any of the elements in the List
was
not a Parameter
.public static Parameters create(List parameters, char delimiter)
Utility method to create a new Parameters
instance from a
List
of Parameter
instances.
Parameters
instance or
null if the specified List
was null, empty
or did not contain any Parameter
.
ClassCastException
- if any of the elements in the List
was
not a Parameter
.public static Parameters parse(String parameters)
Parse the specified parameters String
into a
Parameters
instance using the default
parameter delimiter
.
Parameters
instance or
null if the specified string was null, empty or
did not contain any Parameter
.public static Parameters parse(String parameters, char delimiter)
Parse the specified parameters String
into a
Parameters
instance using the specified character as the
parameters delimiter.
Parameters
instance or
null if the specified string was null, empty or
did not contain any Parameter
.public static Parameters parse(String parameters, String encoding) throws UnsupportedEncodingException
Parse the specified parameters String
into a
Parameters
instance using the default
parameter delimiter
.
Parameters
instance or
null if the specified string was null, empty or
did not contain any Parameter
.
UnsupportedEncodingException
public static Parameters parse(String parameters, char delimiter, String encoding) throws UnsupportedEncodingException
Parse the specified parameters String
into a
Parameters
instance using the specified character as the
parameters delimiter.
Parameters
instance or
null if the specified string was null, empty or
did not contain any Parameter
.
UnsupportedEncodingException
public int size()
Return the number of Parameter
s
contained by this instance.
size
in interface List
public Object get(int index)
Return the Parameter
stored by this\
instance at the specified index.
get
in interface List
public Set getNames()
public String getValue(String name)
Return the first String
value associated with the
specified parameter name, or null.
public List getValues(String name)
Return an immutable List
of all String
values
associated with the specified parameter name, or null.
public String toString()
Return the URL-encoded String
representation of this
Parameters
instance.
toString
in interface Encodable
public String toString(String encoding) throws UnsupportedEncodingException
Return the URL-encoded String
representation of this
Parameters
instance using the specified
character encoding.
toString
in interface Encodable
UnsupportedEncodingException
- if the specified encoding is not
supported by the platform.public int hashCode()
Return the hash code value of this
Parameters
instance.
hashCode
in interface List
public boolean equals(Object object)
Check if the specified Object
is equal to this
Parameters
instance.
The specified Object
is considered equal to this one if
it is non-null, it is a Parameters
instance, and its string representation
equals
this one's.
equals
in interface List
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |