Package org.gatein.pc.api
Class ParametersStateString
- java.lang.Object
-
- org.gatein.pc.api.StateString
-
- org.gatein.pc.api.ParametersStateString
-
- All Implemented Interfaces:
Serializable
public class ParametersStateString extends StateString implements Serializable
A set of parameters.- Version:
- $Revision: 6549 $
- Author:
- Julien Viet
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.gatein.pc.api.StateString
EMPTY, JBPNS_PREFIX, OPAQUE, SERIALIZED
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedParametersStateString()Creates an empty parameter set.protectedParametersStateString(DataInputStream in)protectedParametersStateString(String opaqueValue)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all the parameters.static ParametersStateStringcreate()static ParametersStateStringcreate(Map<String,String[]> parameters)static ParametersStateStringcreate(StateString stateString)Create a parameters state string.booleanequals(Object obj)Map<String,String[]>getParameters()Return the underlying parameter object.intgetSize()Return the size.StringgetStringValue()Retrieves the opaque version associated with this navigational state.StringgetValue(String name)Return the parameter value or null if it does not exist.String[]getValues(String name)Return the parameter values or null if it does not exist.inthashCode()voidremove(String name)Remove a parameter.voidreplace(Map<String,String[]> map)Replace all the parameters.voidsetValue(String name, String value)Set the a parameter value.voidsetValues(String name, String[] values)Set the parameter values.StringtoString()voidwriteTo(DataOutputStream out)-
Methods inherited from class org.gatein.pc.api.StateString
create, create, decodeOpaqueValue, encodeAsOpaqueValue
-
-
-
-
Constructor Detail
-
ParametersStateString
protected ParametersStateString(DataInputStream in) throws IOException
- Throws:
IOException
-
ParametersStateString
protected ParametersStateString(String opaqueValue)
-
ParametersStateString
protected ParametersStateString()
Creates an empty parameter set.
-
-
Method Detail
-
create
public static ParametersStateString create()
-
create
public static ParametersStateString create(Map<String,String[]> parameters)
-
create
public static ParametersStateString create(StateString stateString) throws IllegalArgumentException
Create a parameters state string. It assumes that the argument is either an instance ofParametersStateStringor that it is the string encoded value of aParametersStateString.- Parameters:
stateString- the state string- Returns:
- a new parameter state string
- Throws:
IllegalArgumentException- if the state string is opaque and does not represent parameters
-
getValue
public String getValue(String name) throws IllegalArgumentException
Return the parameter value or null if it does not exist.- Parameters:
name- the parameter name- Returns:
- the parameter value or null if it does not exist
- Throws:
IllegalArgumentException- if the name is null
-
getValues
public String[] getValues(String name) throws IllegalArgumentException
Return the parameter values or null if it does not exist.- Parameters:
name- the value to get- Returns:
- the parameter values
- Throws:
IllegalArgumentException- if the name is null
-
clear
public void clear()
Clear all the parameters.
-
replace
public void replace(Map<String,String[]> map)
Replace all the parameters.- Parameters:
map- the map to replace- Throws:
IllegalArgumentException- if the map is not valid
-
setValue
public void setValue(String name, String value)
Set the a parameter value.- Parameters:
name- the parameter namevalue- the parameter value- Throws:
IllegalArgumentException- if the name or the value is null
-
setValues
public void setValues(String name, String[] values)
Set the parameter values. This method does not make a defensive copy of the values.- Parameters:
name- the parameter namevalues- the parameter values- Throws:
IllegalArgumentException- if the name is null
-
remove
public void remove(String name)
Remove a parameter.- Parameters:
name- the parameter name- Throws:
IllegalArgumentException- if the name is null
-
getSize
public int getSize()
Return the size.- Returns:
- the size
-
getParameters
public Map<String,String[]> getParameters()
Return the underlying parameter object.- Returns:
- the parameter object
-
getStringValue
public String getStringValue()
Retrieves the opaque version associated with this navigational state.- Specified by:
getStringValuein classStateString- Returns:
- a URL-safe String representation of this navigational state.
-
writeTo
public void writeTo(DataOutputStream out) throws IOException
- Specified by:
writeToin classStateString- Throws:
IOException
-
-