juzu.request
Class RequestParameter

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<String>
          extended by juzu.request.RequestParameter
All Implemented Interfaces:
Iterable<String>, Collection<String>, List<String>

public final class RequestParameter
extends AbstractList<String>

A unmodifiable request parameter, it provides access to the parameter name and the parameter values. The parameter name and values are decoded according, the request parameter provides access to the raw parameter x-www-formurl-encoded values when they are available.

Author:
Julien Viet

Method Summary
<M extends Map<String,RequestParameter>>
M
addTo(M map)
          Add this parameter to a map.
 RequestParameter append(RequestParameter appended)
           
 RequestParameter append(String[] appended)
           
static RequestParameter create(Map.Entry<String,String[]> entry)
          Create new parameter.
static RequestParameter create(String name, String value)
          Create new parameter.
static RequestParameter create(String name, String[] value)
          Create new parameter.
static RequestParameter create(String name, String raw, String value)
          Create new parameter.
 boolean equals(Object obj)
           
 String get(int index)
           
 String getName()
           
 String getRaw(int index)
          Returns the value at specified index.
 String getValue()
           
 int size()
           
 String[] toArray()
          Clone the value and returns it.
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray
 

Method Detail

create

public static RequestParameter create(String name,
                                      String value)
                               throws NullPointerException
Create new parameter.

Parameters:
name - the parameter name
value - the parameter value
Returns:
the new parameter
Throws:
NullPointerException - if the name of the value is null

create

public static RequestParameter create(String name,
                                      String raw,
                                      String value)
                               throws NullPointerException
Create new parameter.

Parameters:
name - the parameter name
value - the parameter value
Returns:
the new parameter
Throws:
NullPointerException - if the name of the value is null

create

public static RequestParameter create(String name,
                                      String[] value)
                               throws NullPointerException,
                                      IllegalArgumentException
Create new parameter.

Parameters:
name - the parameter name
value - the parameter value
Returns:
the new parameter
Throws:
NullPointerException - if the name of the value is null
IllegalArgumentException - if the value is empty or contains a null component

create

public static RequestParameter create(Map.Entry<String,String[]> entry)
                               throws NullPointerException,
                                      IllegalArgumentException
Create new parameter.

Parameters:
entry - the parameter entry
Returns:
the new parameter
Throws:
NullPointerException - if the entry is null
IllegalArgumentException - if entry provides a null name or an illegal value

get

public String get(int index)
Specified by:
get in interface List<String>
Specified by:
get in class AbstractList<String>

size

public int size()
Specified by:
size in interface Collection<String>
Specified by:
size in interface List<String>
Specified by:
size in class AbstractCollection<String>

getName

public String getName()
Returns:
the parameter name

getValue

public String getValue()
Returns:
the first parameter value

getRaw

public String getRaw(int index)
Returns the value at specified index.

Parameters:
index - the index of the value
Returns:
the value or null if the index is out of bounds

toArray

public String[] toArray()
Clone the value and returns it.

Specified by:
toArray in interface Collection<String>
Specified by:
toArray in interface List<String>
Overrides:
toArray in class AbstractCollection<String>
Returns:
the value as a String[]

addTo

public <M extends Map<String,RequestParameter>> M addTo(M map)
Add this parameter to a map.

Type Parameters:
M - the map generic type
Parameters:
map - the map to add to
Returns:
the map argument

equals

public boolean equals(Object obj)
Specified by:
equals in interface Collection<String>
Specified by:
equals in interface List<String>
Overrides:
equals in class AbstractList<String>

append

public RequestParameter append(RequestParameter appended)

append

public RequestParameter append(String[] appended)

toString

public String toString()
Overrides:
toString in class AbstractCollection<String>


Copyright © 2013 eXo Platform SAS. All Rights Reserved.