java.lang.Object
org.omnifaces.component.SimpleParam<T>
- Type Parameters:
T- The type of the value.
- All Implemented Interfaces:
ValueHolder,ParamHolder<T>
This class provides a basic and default implementation of the
ParamHolder interface. Ultimately, this class
can be used as a simple key-value pair holder (parameter name-value) which uses an explicit/implicit Faces converter
to convert the object value to string.- Since:
- 1.7
- Author:
- Bauke Scholtz
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SimpleParam(UIParameter param) Construct a simple param with name and value of givenUIParametercomponent.SimpleParam(String name, T value) Construct a simple param with name and value.SimpleParam(String name, T value, Converter<T> converter) Construct a simple param with name, value and converter.SimpleParam(ParamHolder<T> param) Construct a simple param with name, value and converter of givenParamHolderinstance. -
Method Summary
Modifier and TypeMethodDescriptionReturns the converter, if any.Returns the original, unconverted value of the parameter.getName()Returns the name of the parameter.getValue()Returns the value of the parameter asString.voidsetConverter(Converter converter) voidSets the parameter name.void
-
Constructor Details
-
SimpleParam
public SimpleParam()Default constructor. -
SimpleParam
Construct a simple param with name and value.- Parameters:
name- The parameter name.value- The parameter value.
-
SimpleParam
Construct a simple param with name, value and converter.- Parameters:
name- The parameter name.value- The parameter value.converter- The converter.
-
SimpleParam
Construct a simple param with name and value of givenUIParametercomponent.- Parameters:
param- TheUIParameterto copy.- Throws:
ClassCastException- When actual parameter value is notT.- Since:
- 2.2
-
SimpleParam
Construct a simple param with name, value and converter of givenParamHolderinstance.- Parameters:
param- TheParamHolderto copy.- Since:
- 2.2
-
-
Method Details
-
getName
Description copied from interface:ParamHolderReturns the name of the parameter.- Specified by:
getNamein interfaceParamHolder<T>- Returns:
- The name of the parameter.
-
setName
Sets the parameter name.- Parameters:
name- The parameter name.
-
getLocalValue
Description copied from interface:ParamHolderReturns the original, unconverted value of the parameter.- Specified by:
getLocalValuein interfaceParamHolder<T>- Specified by:
getLocalValuein interfaceValueHolder- Returns:
- The original, unconverted value of the parameter.
-
getValue
Description copied from interface:ParamHolderReturns the value of the parameter asString. If the converter is set, or if any converter is available byApplication.createConverter(Class), passing the value's class, then return the result ofConverter.getAsString(jakarta.faces.context.FacesContext, jakarta.faces.component.UIComponent, Object), otherwise return theObject.toString()of the value.- Specified by:
getValuein interfaceParamHolder<T>- Specified by:
getValuein interfaceValueHolder- Returns:
- The value of the parameter as
String. - See Also:
-
setValue
- Specified by:
setValuein interfaceValueHolder- Throws:
ClassCastException- When actual value is notT.
-
getConverter
Description copied from interface:ParamHolderReturns the converter, if any.- Specified by:
getConverterin interfaceParamHolder<T>- Specified by:
getConverterin interfaceValueHolder- Returns:
- The converter, if any.
-
setConverter
- Specified by:
setConverterin interfaceValueHolder
-