Package jakarta.faces.convert
Class DateTimeConverter
- java.lang.Object
-
- jakarta.faces.convert.DateTimeConverter
-
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,Converter
@JSFConverter(name="f:convertDateTime", bodyContent="empty") @JSFJspProperty(name="binding", returnType="jakarta.faces.convert.DateTimeConverter", longDesc="A ValueExpression that evaluates to a DateTimeConverter.") public class DateTimeConverter extends Object implements Converter, PartialStateHolder
This tag associates a date time converter with the nearest parent UIComponent. Unless otherwise specified, all attributes accept static values or EL expressions. see Javadoc of Faces Specification
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONVERTER_ID
static String
DATE_ID
static String
DATETIME_ID
static String
STRING_ID
static String
TIME_ID
-
Fields inherited from interface jakarta.faces.convert.Converter
DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
-
-
Constructor Summary
Constructors Constructor Description DateTimeConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearInitialState()
Object
getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
String
getAsString(FacesContext facesContext, UIComponent uiComponent, Object value)
String
getDateStyle()
The style of the date.Locale
getLocale()
The name of the locale to be used, instead of the default.String
getPattern()
A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.String
getTimeStyle()
The style of the time.TimeZone
getTimeZone()
The time zone to use instead of GMT (the default timezone).String
getType()
Specifies whether the date, time, or both should be parsed/formatted.boolean
initialStateMarked()
boolean
isTransient()
void
markInitialState()
void
restoreState(FacesContext facesContext, Object state)
Object
saveState(FacesContext facesContext)
void
setDateStyle(String dateStyle)
void
setLocale(Locale locale)
void
setPattern(String pattern)
void
setTimeStyle(String timeStyle)
void
setTimeZone(TimeZone timeZone)
void
setTransient(boolean aTransient)
void
setType(String type)
-
-
-
Field Detail
-
CONVERTER_ID
public static final String CONVERTER_ID
- See Also:
- Constant Field Values
-
DATE_ID
public static final String DATE_ID
- See Also:
- Constant Field Values
-
DATETIME_ID
public static final String DATETIME_ID
- See Also:
- Constant Field Values
-
STRING_ID
public static final String STRING_ID
- See Also:
- Constant Field Values
-
TIME_ID
public static final String TIME_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAsObject
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
- Specified by:
getAsObject
in interfaceConverter
-
getAsString
public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object value)
- Specified by:
getAsString
in interfaceConverter
-
restoreState
public void restoreState(FacesContext facesContext, Object state)
- Specified by:
restoreState
in interfaceStateHolder
-
saveState
public Object saveState(FacesContext facesContext)
- Specified by:
saveState
in interfaceStateHolder
-
getDateStyle
@JSFProperty public String getDateStyle()
The style of the date. Values include: default, short, medium, long, and full.
-
setDateStyle
public void setDateStyle(String dateStyle)
-
getLocale
@JSFProperty public Locale getLocale()
The name of the locale to be used, instead of the default.
-
setLocale
public void setLocale(Locale locale)
-
getPattern
@JSFProperty public String getPattern()
A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.
-
setPattern
public void setPattern(String pattern)
-
getTimeStyle
@JSFProperty public String getTimeStyle()
The style of the time. Values include: default, short, medium, long, and full.
-
setTimeStyle
public void setTimeStyle(String timeStyle)
-
getTimeZone
@JSFProperty public TimeZone getTimeZone()
The time zone to use instead of GMT (the default timezone). When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String).
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
-
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interfaceStateHolder
-
setTransient
public void setTransient(boolean aTransient)
- Specified by:
setTransient
in interfaceStateHolder
-
getType
@JSFProperty public String getType()
Specifies whether the date, time, or both should be parsed/formatted. Valid values are: "date", "time", "both", "localDate", "localDateTime", "localTime", "offsetTime", "offsetDateTime", and "zonedDateTime". The prefixes "local", "offset", "zoned" are used, when the type of the value is one of the corresponding Java 8 Date Time API classes. Default is "date".
-
setType
public void setType(String type)
-
clearInitialState
public void clearInitialState()
- Specified by:
clearInitialState
in interfacePartialStateHolder
-
initialStateMarked
public boolean initialStateMarked()
- Specified by:
initialStateMarked
in interfacePartialStateHolder
-
markInitialState
public void markInitialState()
- Specified by:
markInitialState
in interfacePartialStateHolder
-
-