org.apache.myfaces.custom.convertboolean
Class BooleanConverter
java.lang.Object
org.apache.myfaces.custom.convertboolean.BooleanConverter
- All Implemented Interfaces:
- javax.faces.component.StateHolder, javax.faces.convert.Converter
public class BooleanConverter
- extends java.lang.Object
- implements javax.faces.convert.Converter, javax.faces.component.StateHolder
Converter that translates between boolean values (true/false)
and alternate versions of those boolean values like
(yes/no), (1/0), and (way/no way).
To customize the representation of a boolean true and false,
use setTrueValue(String)
and setFalseValue(String)
respectively. If not configured with these setter methods,
it defaults to true
and false
.
The values are case sensitive.
- Author:
- Ken Weiner
Method Summary |
java.lang.Object |
getAsObject(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
java.lang.String value)
|
java.lang.String |
getAsString(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
java.lang.Object value)
|
java.lang.String |
getFalseValue()
Value representing a boolean false, e.g. |
java.lang.String |
getTrueValue()
Value representing a boolean true, e.g. |
boolean |
isTransient()
|
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
|
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
|
void |
setFalseValue(java.lang.String falseValue)
|
void |
setTransient(boolean newTransientValue)
|
void |
setTrueValue(java.lang.String trueValue)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CONVERTER_ID
public static final java.lang.String CONVERTER_ID
- See Also:
- Constant Field Values
BooleanConverter
public BooleanConverter()
getFalseValue
public java.lang.String getFalseValue()
- Value representing a boolean false, e.g. FALSE, no, 0, etc.
setFalseValue
public void setFalseValue(java.lang.String falseValue)
getTrueValue
public java.lang.String getTrueValue()
- Value representing a boolean true, e.g. TRUE, yes, 1, etc.
setTrueValue
public void setTrueValue(java.lang.String trueValue)
getAsObject
public java.lang.Object getAsObject(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
java.lang.String value)
throws javax.faces.convert.ConverterException
- Specified by:
getAsObject
in interface javax.faces.convert.Converter
- Throws:
javax.faces.convert.ConverterException
getAsString
public java.lang.String getAsString(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent uiComponent,
java.lang.Object value)
throws javax.faces.convert.ConverterException
- Specified by:
getAsString
in interface javax.faces.convert.Converter
- Throws:
javax.faces.convert.ConverterException
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interface javax.faces.component.StateHolder
setTransient
public void setTransient(boolean newTransientValue)
- Specified by:
setTransient
in interface javax.faces.component.StateHolder
restoreState
public void restoreState(javax.faces.context.FacesContext context,
java.lang.Object state)
- Specified by:
restoreState
in interface javax.faces.component.StateHolder
saveState
public java.lang.Object saveState(javax.faces.context.FacesContext context)
- Specified by:
saveState
in interface javax.faces.component.StateHolder
Copyright © 2011 The Apache Software Foundation. All Rights Reserved.