public class MonthNameConverter extends DefaultObjectConverter<java.lang.Integer>
| Modifier and Type | Field and Description |
|---|---|
static java.text.DateFormat |
CONCISE_FORMAT
0 -> "1", 1 -> "2", ..., 11 -> "12"
|
static ConverterContext |
CONTEXT
Default ConverterContext for MonthConverter.
|
static java.text.DateFormat |
LONG_FORMAT
0 -> "January", 1 -> "February", ..., 11 -> "December"
|
static java.text.DateFormat |
MEDIUM_FORMAT
0 -> "Jan", 1 -> "Feb", ..., 11 -> "Dec"
|
static java.text.DateFormat |
SHORT_FORMAT
0 -> "01", 1 -> "02", ..., 11 -> "12"
|
| Constructor and Description |
|---|
MonthNameConverter()
Creates a new CalendarConverter.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Integer |
fromString(java.lang.String string,
ConverterContext context)
Converts the month name to the int value.
|
java.text.DateFormat |
getDefaultDateFormat()
Gets default format to format a month.
|
void |
setDefaultDateFormat(java.text.DateFormat defaultDateFormat)
Sets default format to format a month.
|
java.lang.String |
toString(java.lang.Integer value,
ConverterContext context)
Converts the integer to the month names.
|
fromString, getObjectConverterManager, toString, toStringConverterpublic static final ConverterContext CONTEXT
public static final java.text.DateFormat CONCISE_FORMAT
public static final java.text.DateFormat SHORT_FORMAT
public static final java.text.DateFormat MEDIUM_FORMAT
public static final java.text.DateFormat LONG_FORMAT
public java.lang.String toString(java.lang.Integer value,
ConverterContext context)
getDefaultDateFormat()
which is "MMM" by default.toString in interface ObjectConverter<java.lang.Integer>toString in class DefaultObjectConverter<java.lang.Integer>value - the integer value of the month.context - the converter context.public java.lang.Integer fromString(java.lang.String string,
ConverterContext context)
setDefaultDateFormat(java.text.DateFormat), that will be the first DateFormat to be tried. If failed, in order
to ensure the conversion is success, it will try more DateFormats in the following order: "MM", "MMM", "MMMMM",
"M".fromString in interface ObjectConverter<java.lang.Integer>fromString in class DefaultObjectConverter<java.lang.Integer>string - the stringcontext - the converter context.public java.text.DateFormat getDefaultDateFormat()
public void setDefaultDateFormat(java.text.DateFormat defaultDateFormat)
MEDIUM_FORMAT.defaultDateFormat - the default format to format the month.