Package lumis.util
Class PortletParametersMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<java.lang.String,java.lang.String[]>
-
- lumis.util.PortletParametersMap
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<java.lang.String,java.lang.String[]>
public class PortletParametersMap extends java.util.LinkedHashMap<java.lang.String,java.lang.String[]>
Implements a Map for parameters with the usual constraints specified in the JSR-168 interfaces, as inActionResponse
andPortletURL
.The constraints are:
- key must not be null and must be a String
- value must not be null and must be a String[]
If any of the constraints above are violated, an
IllegalArgumentException
is thrown when the parameter is tried to be set.The String array values are cloned, so changes in the given array instance will not affect the value stored in the map.
For this behavior to be applied, the methods
setParameter(String, String)
,setParameter(String, String[])
orsetParameters(Map)
must be used. TheMap
methods do not behave as stated above.- Since:
- 4.0.7
- Version:
- $Revision: 16976 $ $Date: 2015-02-20 15:36:20 -0200 (Fri, 20 Feb 2015) $
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PortletParametersMap()
PortletParametersMap(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PortletParametersMap
clone()
Clones thisPortletParametersMap
, also cloning the arrays in the values to prevent the clone from affecting the original.void
setParameter(java.lang.String key, java.lang.String value)
Sets a String parameter.void
setParameter(java.lang.String key, java.lang.String[] values)
Sets a String array parameter.void
setParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
Sets a parameter map.-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
setParameter
public void setParameter(java.lang.String key, java.lang.String value)
Sets a String parameter.This method replaces all parameters with the given key.
- Parameters:
key
- key of the parametervalue
- value of the parameter- Throws:
java.lang.IllegalArgumentException
- if key or value arenull
.- Since:
- 4.0.7
-
setParameter
public void setParameter(java.lang.String key, java.lang.String[] values)
Sets a String array parameter.This method replaces all parameters with the given key.
- Parameters:
key
- key of the parametervalues
- values of the parameter- Throws:
java.lang.IllegalArgumentException
- if key or value arenull
.- Since:
- 4.0.7
-
setParameters
public void setParameters(java.util.Map<java.lang.String,java.lang.String[]> parameters)
Sets a parameter map.All previously set render parameters are cleared.
- Parameters:
parameters
- Map containing the parameters. The keys in the parameter map must be of type String. The values in the parameter map must be of type String array (String[]
).- Throws:
java.lang.IllegalArgumentException
- if parameters isnull
, if any of the key/values in the Map arenull
, if any of the keys is not a String, or if any of the values is not a String array.- Since:
- 4.0.7
-
clone
public PortletParametersMap clone()
Clones thisPortletParametersMap
, also cloning the arrays in the values to prevent the clone from affecting the original.The keys and the array elements are not cloned since they are immutable.
- Overrides:
clone
in classjava.util.HashMap<java.lang.String,java.lang.String[]>
- Returns:
- the cloned
PortletParametersMap
. - Since:
- 5.5.0
-
-