public class GenericMaskConverter extends AbstractStateHolder implements javax.faces.convert.Converter, Serializable
Mask
to do the actual masking and unmasking.Constructor and Description |
---|
GenericMaskConverter() |
Modifier and Type | Method and Description |
---|---|
Object |
getAsObject(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String maskedValue)
Converts the supplied maskedValue to a String that does not contain any mask characters.
|
String |
getAsString(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
Object unmaskedValue)
Converts the supplied unmaskedValue to a masked value.
|
String |
getMask()
Gets the mask attribute.
|
void |
restoreState(javax.faces.context.FacesContext facesContext,
Object state)
Restores the state saved by
saveState(FacesContext) . |
Object |
saveState(javax.faces.context.FacesContext facesContext)
Saves the state of this converter.
|
void |
setMask(String mask)
Sets the mask attribute.
|
isTransient, setTransient
public String getMask()
public void setMask(String mask)
mask
- The mask attribute.public Object getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String maskedValue)
getAsObject
in interface javax.faces.convert.Converter
facesContext
- Faces Context.component
- The UI component that stores the unmasked value.maskedValue
- The value to convert.javax.faces.convert.ConverterException
- When the supplied maskedValue does not correspond to the mask.public String getAsString(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, Object unmaskedValue)
getAsString
in interface javax.faces.convert.Converter
facesContext
- Faces Context.component
- The UI component that stores the unmasked value.unmaskedValue
- The unmasked value to convert to a masked value.String
.
When a conversion error occurs, the supplied unmaskedValue is returned as a String.javax.faces.convert.ConverterException
- When the supplied unmaskedValue does not correspond to the mask.public Object saveState(javax.faces.context.FacesContext facesContext)
saveState
in interface javax.faces.component.StateHolder
facesContext
- The FacesContext.public void restoreState(javax.faces.context.FacesContext facesContext, Object state)
saveState(FacesContext)
.restoreState
in interface javax.faces.component.StateHolder
facesContext
- The FacesContext.state
- The state saved by saveState(FacesContext)
.Copyright © 2008–2018. All rights reserved.