com.bea.netuix.util
Class PortletParameters

java.lang.Object
  extended by com.bea.netuix.util.PortletParameters
All Implemented Interfaces
Serializable

public class PortletParameters
extends Object
implements Serializable

Represents a set of parameters for a portlet.

This class exists to avoid repeatedly serializing and deserializing parameters from a string whenever possible, and to ensure consistent encoding and decoding of parameter names and values. This class is NOT internally synchronized.

See Also
Serialized Form

Nested Class Summary
static interface PortletParameters.ParameterFilter
          Implementations of this interface are used to filter out or rename parameters when initially constructing a PortletParameters object.
 
Constructor Summary
PortletParameters()
          Construct an empty PortletParameters
PortletParameters(LinkedHashMap<String,List<String>> paramMap)
          Constructs a new PortletParameters with the given parameter mapping.
PortletParameters(PortletParameters params, PortletParameters.ParameterFilter filter)
          Constructs a new PortletParameters using the specified starting set and optional filter.
PortletParameters(String queryString)
          Construct a PortletParameters with the given initial parameter values
PortletParameters(String queryString, PortletParameters.ParameterFilter filter, String encoding)
          Constructs a new PortletParameters using the specified query string and optional filter.
 
Method Summary
 void append(String name, String[] additionalValues)
          Appends the specified values to the parameter with the given name.
 void appendAll(Map<String,String[]> sourceMap)
          Includes all parameters from the specified object into our own, appending any new values to existing values.
 void appendAll(PortletParameters other)
          Includes all parameters from the specified object into our own, appending any new values to existing values.
 void appendFilteredParameters(PortletParameters other, PortletParameters.ParameterFilter filter)
          Includes all parameters from the specified PortletParameters into this PortletParameters, after running through the specified filter to eliminate and / or rename parameters from the supplied PortletParameters.
 void clear()
          Clears out the parameters
 boolean equals(Object o)
           
 String getAsString()
          Get a string representation (properly encoded) of the parameters
 String getFirstValue(String name)
          Gets the first value for the specified parameter, if a value exists, otherwise null.
 LinkedHashMap<String,String[]> getParameterMap()
          Returns a deep copy of the internal map of parameters, with values as a String array.
 LinkedHashMap<String,List<String>> getParameterMapList()
          Returns a deep copy of the internal map of parameters, with values as a List of String
 int getSize()
          Returns the number of discreet mappings contained
 String[] getValues(String name)
          Returns the set of values for the specified parameter
 Set<String> keySet()
           
static LinkedHashMap<String,List<String>> parseQueryString(String queryString, String encoding, PortletParameters.ParameterFilter filter)
          Parses a query string into a map, using the specified encoding and optional parameter filter.
 void put(String name, String[] value)
          Puts the specified parameter mapping in, replacing any previous values
 void setEncoding(String encoding)
          Sets the encoding
 void setFromString(String params)
          Sets ALL values from the given string, wiping out all previous settings
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PortletParameters

public PortletParameters(String queryString)
Construct a PortletParameters with the given initial parameter values

Parameters
queryString - the query string to use

PortletParameters

public PortletParameters()
Construct an empty PortletParameters


PortletParameters

public PortletParameters(LinkedHashMap<String,List<String>> paramMap)
Constructs a new PortletParameters with the given parameter mapping. The supplied map is not cloned, so it should not be altered externally after calling this constructor!


PortletParameters

public PortletParameters(String queryString,
                         PortletParameters.ParameterFilter filter,
                         String encoding)
Constructs a new PortletParameters using the specified query string and optional filter. The filter is applied ONLY when the object is constructed, not during subsequent operations.

Parameters
queryString - the query string to parse
encoding - the encoding to use
filter - the parameter filter to use when constructing this object, which can rename parameters or eliminate them from the resulting map.

PortletParameters

public PortletParameters(PortletParameters params,
                         PortletParameters.ParameterFilter filter)
Constructs a new PortletParameters using the specified starting set and optional filter. The filter is applied ONLY when the object is constructed, not during subsequent operations.

Parameters
params - the starting set of parameters
filter - the parameter filter to use when constructing this object, which can rename parameters or eliminate them from the original set.
Method Detail

setEncoding

public void setEncoding(String encoding)
Sets the encoding


getAsString

public String getAsString()
Get a string representation (properly encoded) of the parameters


setFromString

public void setFromString(String params)
Sets ALL values from the given string, wiping out all previous settings


put

public void put(String name,
                String[] value)
Puts the specified parameter mapping in, replacing any previous values


getFirstValue

public String getFirstValue(String name)
Gets the first value for the specified parameter, if a value exists, otherwise null.


getValues

public String[] getValues(String name)
Returns the set of values for the specified parameter


appendAll

public void appendAll(PortletParameters other)
Includes all parameters from the specified object into our own, appending any new values to existing values.


appendFilteredParameters

public void appendFilteredParameters(PortletParameters other,
                                     PortletParameters.ParameterFilter filter)
Includes all parameters from the specified PortletParameters into this PortletParameters, after running through the specified filter to eliminate and / or rename parameters from the supplied PortletParameters. The supplied object is NOT affected.


appendAll

public void appendAll(Map<String,String[]> sourceMap)
Includes all parameters from the specified object into our own, appending any new values to existing values.


append

public void append(String name,
                   String[] additionalValues)
Appends the specified values to the parameter with the given name.


clear

public void clear()
Clears out the parameters


getParameterMap

public LinkedHashMap<String,String[]> getParameterMap()
Returns a deep copy of the internal map of parameters, with values as a String array.


getParameterMapList

public LinkedHashMap<String,List<String>> getParameterMapList()
Returns a deep copy of the internal map of parameters, with values as a List of String


keySet

public Set<String> keySet()

getSize

public int getSize()
Returns the number of discreet mappings contained


toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

parseQueryString

public static LinkedHashMap<String,List<String>> parseQueryString(String queryString,
                                                                  String encoding,
                                                                  PortletParameters.ParameterFilter filter)
Parses a query string into a map, using the specified encoding and optional parameter filter.

Parameters
queryString - the query string to parse, cannot be null
encoding - the encoding to use, cannot be null
filter - the parameter filter to use when constructing the map, which can rename parameters or eliminate them from the resulting map.


Copyright © 2008 BEA Systems, Inc. All Rights Reserved