|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.util.WrapperList<T>
org.restlet.util.Series<T>
T
- The contained typepublic class Series<T extends NamedValue<String>>
Modifiable list of entries with many helper methods. Note that this class uses the Parameter class as the template type. This allows you to use an instance of this class as any other java.util.List, in particular all the helper methods in java.util.Collections.
Parameter
,
Collections
,
List
Field Summary | |
---|---|
static Object |
EMPTY_VALUE
A marker for empty values to differentiate from non existing values (null). |
Constructor Summary | |
---|---|
Series(Class<T> entryClass)
Constructor. |
|
Series(Class<T> entryClass,
int initialCapacity)
Constructor. |
|
Series(Class<T> entryClass,
List<T> delegate)
Constructor. |
Method Summary | |
---|---|
boolean |
add(String name,
String value)
Creates then adds a parameter at the end of the list. |
void |
copyTo(Map<String,Object> params)
Copies the parameters whose name is a key in the given map. If a matching parameter is found, its value is put in the map. If multiple values are found, a list is created and set in the map. |
T |
createEntry(String name,
String value)
Creates a new entry. |
Series<T> |
createSeries(List<T> delegate)
Deprecated. Use Series(Class, List) constructor instead. |
T |
getFirst(String name)
Returns the first parameter found with the given name. |
T |
getFirst(String name,
boolean ignoreCase)
Returns the first parameter found with the given name. |
String |
getFirstValue(String name)
Returns the value of the first parameter found with the given name. |
String |
getFirstValue(String name,
boolean ignoreCase)
Returns the value of the first parameter found with the given name. |
String |
getFirstValue(String name,
boolean ignoreCase,
String defaultValue)
Returns the value of the first parameter found with the given name. |
String |
getFirstValue(String name,
String defaultValue)
Returns the value of the first parameter found with the given name. |
Set<String> |
getNames()
Returns the set of parameter names (case sensitive). |
String |
getValues(String name)
Returns the values of the parameters with a given name. |
String |
getValues(String name,
String separator,
boolean ignoreCase)
Returns the parameter values with a given name. |
String[] |
getValuesArray(String name)
Returns an array of all the values associated to the given parameter name. |
String[] |
getValuesArray(String name,
boolean ignoreCase)
Returns an array of all the values associated to the given parameter name. |
String[] |
getValuesArray(String name,
boolean ignoreCase,
String defaultValue)
Returns an array of all the values associated to the given parameter name. |
String[] |
getValuesArray(String name,
String defaultValue)
Returns an array of all the values associated to the given parameter name. |
Map<String,String> |
getValuesMap()
Returns a map of name, value pairs. |
boolean |
removeAll(String name)
Removes all the parameters with a given name. |
boolean |
removeAll(String name,
boolean ignoreCase)
Removes all the parameters with a given name. |
boolean |
removeFirst(String name)
Removes from this list the first entry whose name equals the specified name ignoring the case. |
boolean |
removeFirst(String name,
boolean ignoreCase)
Removes from this list the first entry whose name equals the specified name ignoring the case or not. |
T |
set(String name,
String value)
Replaces the value of the first parameter with the given name and removes all other parameters with the same name. |
T |
set(String name,
String value,
boolean ignoreCase)
Replaces the value of the first parameter with the given name and removes all other parameters with the same name. |
Series<T> |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. |
Series<T> |
subList(String name)
Returns a list of all the values associated to the parameter name. |
Series<T> |
subList(String name,
boolean ignoreCase)
Returns a list of all the values associated to the parameter name. |
static Series<? extends NamedValue> |
unmodifiableSeries(Series<? extends NamedValue> series)
Returns an unmodifiable view of the specified series. |
Methods inherited from class org.restlet.util.WrapperList |
---|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, getDelegate, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Object EMPTY_VALUE
Constructor Detail |
---|
public Series(Class<T> entryClass)
public Series(Class<T> entryClass, int initialCapacity)
initialCapacity
- The initial list capacity.public Series(Class<T> entryClass, List<T> delegate)
delegate
- The delegate list.Method Detail |
---|
public static Series<? extends NamedValue> unmodifiableSeries(Series<? extends NamedValue> series)
series
- The series for which an unmodifiable view should be returned.
public boolean add(String name, String value)
name
- The parameter name.value
- The parameter value.
public void copyTo(Map<String,Object> params)
params
- The map controlling the copy.public T createEntry(String name, String value)
name
- The name of the entry.value
- The value of the entry.
@Deprecated public Series<T> createSeries(List<T> delegate)
Series(Class, List)
constructor instead.
delegate
- Optional delegate series.
public T getFirst(String name)
name
- The parameter name (case sensitive).
public T getFirst(String name, boolean ignoreCase)
name
- The parameter name.ignoreCase
- Indicates if the name comparison is case insensitive.
public String getFirstValue(String name)
name
- The parameter name (case sensitive).
public String getFirstValue(String name, boolean ignoreCase)
name
- The parameter name.ignoreCase
- Indicates if the name comparison is case sensitive.
public String getFirstValue(String name, boolean ignoreCase, String defaultValue)
name
- The parameter name.ignoreCase
- Indicates if the name comparison is case sensitive.defaultValue
- The default value to return if no matching parameter found or
if the parameter has a null value.
public String getFirstValue(String name, String defaultValue)
name
- The parameter name (case sensitive).defaultValue
- The default value to return if no matching parameter found or
if the parameter has a null value.
public Set<String> getNames()
public String getValues(String name)
name
- The parameter name (case insensitive).
public String getValues(String name, String separator, boolean ignoreCase)
name
- The parameter name.separator
- The separator character.ignoreCase
- Indicates if the name comparison is case sensitive.
public String[] getValuesArray(String name)
name
- The parameter name to match.
public String[] getValuesArray(String name, boolean ignoreCase)
name
- The parameter name to match.ignoreCase
- Indicates if the name comparison is case sensitive.
public String[] getValuesArray(String name, boolean ignoreCase, String defaultValue)
name
- The parameter name to match.ignoreCase
- Indicates if the name comparison is case sensitive.defaultValue
- The default value to return if no matching parameter found or
if the parameter has a null value.
public String[] getValuesArray(String name, String defaultValue)
name
- The parameter name to match.defaultValue
- The default value to return if no matching parameter found or
if the parameter has a null value.
public Map<String,String> getValuesMap()
public boolean removeAll(String name)
name
- The parameter name (case sensitive).
public boolean removeAll(String name, boolean ignoreCase)
name
- The parameter name.ignoreCase
- Indicates if the name comparison is case insensitive.
public boolean removeFirst(String name)
name
- The name of the entries to be removed (case sensitive).
public boolean removeFirst(String name, boolean ignoreCase)
name
- The name of the entries to be removed.ignoreCase
- Indicates if the name comparison is case insensitive.
public T set(String name, String value)
name
- The parameter name.value
- The value to set.
public T set(String name, String value, boolean ignoreCase)
name
- The parameter name.value
- The value to set.ignoreCase
- Indicates if the name comparison is case insensitive.
public Series<T> subList(int fromIndex, int toIndex)
subList
in interface List<T extends NamedValue<String>>
subList
in class WrapperList<T extends NamedValue<String>>
fromIndex
- The start position.toIndex
- The end position (exclusive).
public Series<T> subList(String name)
name
- The parameter name (case sensitive).
public Series<T> subList(String name, boolean ignoreCase)
name
- The parameter name.ignoreCase
- Indicates if the name comparison is case insensitive.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |