|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.faces.convert.BooleanConverter
com.ibm.xsp.convert.BooleanConverter
public class BooleanConverter
The xp:convertDateTime
tag converts a String value to a Boolean,
true or false value. The conversion is not locale-aware, so translated
versions of the words "true" and "false" are not supported.
In the default non-strict mode, Strings that are a case in-sensitive match
for "true" result in the boolean true, while all other values result in the
boolean false.
In strict mode, the check for true is the same, but there is also a
case-insensitive check for "false", which results in the boolean false,
and other values (neither "true" nor "false") will give a validation error.
In either case, a null or empty string value will result in a
null
Boolean
.
This has both client-side and server-side validation.
Field Summary | |
---|---|
static java.lang.String |
CONVERTER_ID
The converter id for this converter, which can be used as a value for the tag property: ConverterImpl.setConverterId(String) . |
Constructor Summary | |
---|---|
BooleanConverter()
|
Method Summary | |
---|---|
java.lang.String |
generateClientSideConverter(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Generate client side conversion. |
java.lang.Object |
getAsObject(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.String value)
Converts the value from a String to null or a
java.lang.Boolean, possibly throwing a
ConverterException . |
java.lang.String |
getAsString(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
java.lang.Object value)
Converts the value to a String from either null (converts to
""), or from a Boolean object. |
javax.faces.component.UIComponent |
getComponent()
See ValueBindingObjectImpl.getComponent() |
protected java.lang.String |
getDefaultMessage()
|
protected javax.faces.context.FacesContext |
getFacesContext()
Helper method to return the current FacesContext. |
java.lang.String |
getMessage()
The message property specified in the XPage source, used when strict=true. |
javax.faces.el.ValueBinding |
getValueBinding(java.lang.String name)
See ValueBindingObjectImpl.getValueBinding(String) |
boolean |
isStrict()
Enforces strict conversion so only the text "false" will be saved as false. |
boolean |
isTransient()
See ValueBindingObjectImpl.isTransient() |
void |
restoreState(javax.faces.context.FacesContext context,
java.lang.Object value)
See ValueBindingObjectImpl.restoreState(FacesContext, Object) |
java.lang.Object |
saveState(javax.faces.context.FacesContext context)
See ValueBindingObjectImpl.saveState(FacesContext) |
void |
setComponent(javax.faces.component.UIComponent component)
See ValueBindingObjectImpl.setComponent(UIComponent) |
void |
setMessage(java.lang.String message)
Sets the validation error message used when in strict mode and the submitted value does not match "true" or "false". |
void |
setStrict(boolean strict)
Sets the strictness mode, by default is non-strict. |
void |
setTransient(boolean transientFlag)
See ValueBindingObjectImpl.setTransient(boolean) |
void |
setValueBinding(java.lang.String name,
javax.faces.el.ValueBinding binding)
See ValueBindingObjectImpl.setValueBinding(String, ValueBinding) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CONVERTER_ID
ConverterImpl.setConverterId(String)
.
Constructor Detail |
---|
public BooleanConverter()
Method Detail |
---|
public java.lang.Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String value)
String
to null or a
java.lang.Boolean, possibly throwing a
ConverterException
.
getAsObject
in interface javax.faces.convert.Converter
getAsObject
in class javax.faces.convert.BooleanConverter
javax.faces.convert.ConverterException
BooleanConverter.getAsObject(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String)
protected java.lang.String getDefaultMessage()
public java.lang.String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
null
(converts to
""), or from a Boolean
object.
getAsString
in interface javax.faces.convert.Converter
getAsString
in class javax.faces.convert.BooleanConverter
BooleanConverter.getAsString(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.Object)
public java.lang.String getMessage()
public void setMessage(java.lang.String message)
message
- the message to setpublic boolean isStrict()
public void setStrict(boolean strict)
strict
- the strict to setprotected javax.faces.context.FacesContext getFacesContext()
ValueBindingObject
.
public javax.faces.el.ValueBinding getValueBinding(java.lang.String name)
ValueBindingObjectImpl.getValueBinding(String)
getValueBinding
in interface ValueBindingObject
name
- Name of the property
ValueBindingObject.getValueBinding(java.lang.String)
public void setValueBinding(java.lang.String name, javax.faces.el.ValueBinding binding)
ValueBindingObjectImpl.setValueBinding(String, ValueBinding)
setValueBinding
in interface ValueBindingObject
name
- Name of the propertybinding
- The ValueBinding to set, or null to remove an existing ValueBindingValueBindingObject.setValueBinding(java.lang.String, javax.faces.el.ValueBinding)
public void setComponent(javax.faces.component.UIComponent component)
ValueBindingObjectImpl.setComponent(UIComponent)
setComponent
in interface ComponentBindingObject
ComponentBindingObject.setComponent(javax.faces.component.UIComponent)
public javax.faces.component.UIComponent getComponent()
ValueBindingObjectImpl.getComponent()
getComponent
in interface ComponentBindingObject
ComponentBindingObject.getComponent()
public boolean isTransient()
ValueBindingObjectImpl.isTransient()
isTransient
in interface javax.faces.component.StateHolder
StateHolder.isTransient()
public void setTransient(boolean transientFlag)
ValueBindingObjectImpl.setTransient(boolean)
setTransient
in interface javax.faces.component.StateHolder
StateHolder.setTransient(boolean)
public java.lang.Object saveState(javax.faces.context.FacesContext context)
ValueBindingObjectImpl.saveState(FacesContext)
saveState
in interface javax.faces.component.StateHolder
StateHolder.saveState(javax.faces.context.FacesContext)
public java.lang.String generateClientSideConverter(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws java.io.IOException
ClientSideConverter
generateClientSideConverter
in interface ClientSideConverter
java.io.IOException
ClientSideConverter.generateClientSideConverter(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
public void restoreState(javax.faces.context.FacesContext context, java.lang.Object value)
ValueBindingObjectImpl.restoreState(FacesContext, Object)
restoreState
in interface javax.faces.component.StateHolder
StateHolder.restoreState(javax.faces.context.FacesContext, java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |