public class DateConverter extends AbstractStateHolder implements javax.faces.convert.Converter, Serializable
Date
.
What differentiates this converter from the standard Date Converter is its ability to process dates without separators for
fast data entry.Constructor and Description |
---|
DateConverter() |
Modifier and Type | Method and Description |
---|---|
Object |
getAsObject(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String stringDate)
Converts the supplied stringDate to an object of type
Date . |
String |
getAsString(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
Object date)
Converts the supplied date to a String.
|
String |
getPattern()
Gets the pattern used for conversion.
|
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 |
setPattern(String pattern)
Sets the pattern used for conversion..
|
isTransient, setTransient
public String getPattern()
SimpleDateFormat
.public void setPattern(String pattern)
SimpleDateFormat
.pattern
- The pattern used for conversion.public Object getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String stringDate)
Date
.getAsObject
in interface javax.faces.convert.Converter
facesContext
- Faces Context.component
- The UI component that stores the date.stringDate
- The Date in String format to convert to a Date.Date
.
public String getAsString(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, Object date)
getAsString
in interface javax.faces.convert.Converter
facesContext
- Faces Context.component
- The UI component that stores the date.date
- The date to convert to a String.Date
.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.