Class PortletParametersWrapper
- java.lang.Object
-
- jakarta.portlet.filter.PortletParametersWrapper
-
- All Implemented Interfaces:
PortletParameters
- Direct Known Subclasses:
ActionParametersWrapper,MutablePortletParametersWrapper,RenderParametersWrapper,ResourceParametersWrapper
public class PortletParametersWrapper extends Object implements PortletParameters
ThePortletParametersWrapperprovides a convenient implementation of thePortletParametersinterface that can be subclassed by developers. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.- Since:
- 3.0
-
-
Field Summary
Fields Modifier and Type Field Description protected PortletParameterswrapped
-
Constructor Summary
Constructors Constructor Description PortletParametersWrapper(PortletParameters wrapped)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MutablePortletParametersclone()Returns aMutablePortletParametersobject encapsulating a copy of the same parameters as the original object.Set<String>getNames()Returns aSetofStringobjects containing the names of the parameters contained in this object.StringgetValue(String name)Returns the value of a parameter as aString.String[]getValues(String name)Returns an array ofStringobjects containing all of the values the given parameter, ornullif the parameter does not exist.PortletParametersgetWrapped()Gets the wrapped object.booleanisEmpty()Returns atrueif no parameters have been set.voidsetWrapped(PortletParameters wrapped)Sets the wrapped object.intsize()Returns the number of parameters in this object.
-
-
-
Field Detail
-
wrapped
protected PortletParameters wrapped
-
-
Constructor Detail
-
PortletParametersWrapper
public PortletParametersWrapper(PortletParameters wrapped)
- Parameters:
wrapped- the wrapped object to set.- Throws:
IllegalArgumentException- if the PortletParameters is null.
-
-
Method Detail
-
getWrapped
public PortletParameters getWrapped()
Gets the wrapped object.- Returns:
- the wrapped object.
-
setWrapped
public void setWrapped(PortletParameters wrapped)
Sets the wrapped object.- Parameters:
wrapped- the wrapped object to set.- Throws:
IllegalArgumentException- if the PortletParameters is null.
-
getValue
public String getValue(String name)
Description copied from interface:PortletParametersReturns the value of a parameter as aString.Note that
nullis a valid parameter value. To determine whether a parameter is present, use theSet.contains(Object)method on the set returned byPortletParameters.getNames().Only parameters targeted to the current portlet are accessible.
This method should only be used if the parameter has only one value. If the parameter might have more than one value, use
PortletParameters.getValues(java.lang.String).If this method is used with a multivalued parameter, the value returned is equal to the first value in the array returned by
getValues.- Specified by:
getValuein interfacePortletParameters- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- a
Stringrepresenting the single value of the parameter, ornull. - See Also:
PortletParameters.getValues(java.lang.String),PortletParameters.getNames()
-
getNames
public Set<String> getNames()
Description copied from interface:PortletParametersReturns aSetofStringobjects containing the names of the parameters contained in this object. Changing theSethas no effect on the originating PortletParameters object.Only parameter names targeted to the current portlet are returned.
- Specified by:
getNamesin interfacePortletParameters- Returns:
- a
SetofStringobjects, eachStringcontaining the name of a parameter; or an emptySetif the PortletParameters object has no parameters.
-
getValues
public String[] getValues(String name)
Description copied from interface:PortletParametersReturns an array ofStringobjects containing all of the values the given parameter, ornullif the parameter does not exist.If the parameter has a single value, the array has a length of 1.
Note that individual parameter values in the returned array may be
null.- Specified by:
getValuesin interfacePortletParameters- Parameters:
name- aStringcontaining the name of the parameter the value of which is requested- Returns:
- an array of
Stringobjects containing the parameter values, ornullif the parameter does not exist. - See Also:
PortletParameters.getValue(java.lang.String)
-
isEmpty
public boolean isEmpty()
Description copied from interface:PortletParametersReturns atrueif no parameters have been set.- Specified by:
isEmptyin interfacePortletParameters- Returns:
trueif the object contains no parameters.falseotherwise
-
size
public int size()
Description copied from interface:PortletParametersReturns the number of parameters in this object.- Specified by:
sizein interfacePortletParameters- Returns:
- the number of parameters in this object
-
clone
public MutablePortletParameters clone()
Description copied from interface:PortletParametersReturns aMutablePortletParametersobject encapsulating a copy of the same parameters as the original object. Changing a mutable copy will not influence the source object.- Specified by:
clonein interfacePortletParameters- Overrides:
clonein classObject- Returns:
- Mutable clone of PortletParameters object
-
-