T
- The type of the value.public class SimpleParam<T> extends Object implements ParamHolder<T>
ParamHolder
interface. Ultimately, this class
can be used as a simple key-value pair holder (parameter name-value) which uses an explicit/implicit JSF converter
to convert the object value to string.Constructor and Description |
---|
SimpleParam()
Default constructor.
|
SimpleParam(ParamHolder<T> param)
Construct a simple param with name, value and converter of given
ParamHolder instance. |
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(UIParameter param)
Construct a simple param with name and value of given
UIParameter component. |
Modifier and Type | Method and Description |
---|---|
Converter<T> |
getConverter()
Returns the converter, if any.
|
T |
getLocalValue()
Returns the original, unconverted value of the parameter.
|
String |
getName()
Returns the name of the parameter.
|
String |
getValue()
Returns the value of the parameter as
String . |
void |
setConverter(Converter converter) |
void |
setName(String name)
Sets the parameter name.
|
void |
setValue(Object value) |
public SimpleParam()
public SimpleParam(String name, T value)
name
- The parameter name.value
- The parameter value.public SimpleParam(String name, T value, Converter<T> converter)
name
- The parameter name.value
- The parameter value.converter
- The converter.public SimpleParam(UIParameter param)
UIParameter
component.param
- The UIParameter
to copy.ClassCastException
- When actual parameter value is not T
.public SimpleParam(ParamHolder<T> param)
ParamHolder
instance.param
- The ParamHolder
to copy.public String getName()
ParamHolder
getName
in interface ParamHolder<T>
public void setName(String name)
name
- The parameter name.public T getLocalValue()
ParamHolder
getLocalValue
in interface ValueHolder
getLocalValue
in interface ParamHolder<T>
public String getValue()
ParamHolder
String
. If the converter is set, or if any converter is available by
Application.createConverter(Class)
, passing the value's class, then return the result of
Converter.getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, Object)
,
otherwise return the Object.toString()
of the value.getValue
in interface ValueHolder
getValue
in interface ParamHolder<T>
String
.Converter.getAsString(javax.faces.context.FacesContext, javax.faces.component.UIComponent, Object)
public void setValue(Object value)
setValue
in interface ValueHolder
ClassCastException
- When actual value is not T
.public Converter<T> getConverter()
ParamHolder
getConverter
in interface ValueHolder
getConverter
in interface ParamHolder<T>
public void setConverter(Converter converter)
setConverter
in interface ValueHolder
Copyright © 2012–2021 OmniFaces. All rights reserved.