public class MonthNameConverter extends Object implements ObjectConverter
| Modifier and Type | Field and Description |
|---|---|
static DateFormat |
CONCISE_FORMAT
0 -> "1", 1 -> "2", ..., 11 -> "12"
|
static ConverterContext |
CONTEXT
Default ConverterContext for MonthConverter.
|
static DateFormat |
LONG_FORMAT
0 -> "January", 1 -> "February", ..., 11 -> "December"
|
static DateFormat |
MEDIUM_FORMAT
0 -> "Jan", 1 -> "Feb", ..., 11 -> "Dec"
|
static DateFormat |
SHORT_FORMAT
0 -> "01", 1 -> "02", ..., 11 -> "12"
|
| Constructor and Description |
|---|
MonthNameConverter()
Creates a new CalendarConverter.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
fromString(String string,
ConverterContext context)
Converts from String to an object.
|
protected Calendar |
getCalendarByMonth(int month) |
DateFormat |
getDefaultFormat()
Gets default format to format a month.
|
static void |
main(String[] args) |
void |
setDefaultFormat(DateFormat defaultFormat)
Sets default format to format a month.
|
boolean |
supportFromString(String string,
ConverterContext context)
If it supports fromString.
|
boolean |
supportToString(Object object,
ConverterContext context)
If it supports toString method.
|
String |
toString(Object object,
ConverterContext context)
Converts from object to String based on current locale.
|
public static ConverterContext CONTEXT
public static final DateFormat CONCISE_FORMAT
public static final DateFormat SHORT_FORMAT
public static final DateFormat MEDIUM_FORMAT
public static final DateFormat LONG_FORMAT
public String toString(Object object, ConverterContext context)
ObjectConvertertoString in interface ObjectConverterobject - object to be convertedcontext - converter context to be usedprotected Calendar getCalendarByMonth(int month)
public boolean supportToString(Object object, ConverterContext context)
ObjectConvertersupportToString in interface ObjectConverterobject - object to be convertedcontext - converter context to be usedpublic Object fromString(String string, ConverterContext context)
ObjectConverterfromString in interface ObjectConverterstring - the stringcontext - context to be convertedpublic boolean supportFromString(String string, ConverterContext context)
ObjectConvertersupportFromString in interface ObjectConverterstring - the stringcontext - context to be convertedpublic DateFormat getDefaultFormat()
public void setDefaultFormat(DateFormat defaultFormat)
MEDIUM_FORMAT.defaultFormat - the default format to format the month.public static void main(String[] args)
Copyright © 2017. All rights reserved.