Package com.jidesoft.converter
Class MonthNameConverter
java.lang.Object
com.jidesoft.converter.MonthNameConverter
- All Implemented Interfaces:
ObjectConverter
Converter which converts int to month string and converts it back.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateFormat
0 -> "1", 1 -> "2", ..., 11 -> "12"static ConverterContext
Default ConverterContext for MonthConverter.static final DateFormat
0 -> "January", 1 -> "February", ..., 11 -> "December"static final DateFormat
0 -> "Jan", 1 -> "Feb", ..., 11 -> "Dec"static final DateFormat
0 -> "01", 1 -> "02", ..., 11 -> "12" -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromString
(String string, ConverterContext context) Converts from String to an object.protected Calendar
getCalendarByMonth
(int month) Gets default format to format a month.static void
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.toString
(Object object, ConverterContext context) Converts from object to String based on current locale.
-
Field Details
-
CONTEXT
Default ConverterContext for MonthConverter. -
CONCISE_FORMAT
0 -> "1", 1 -> "2", ..., 11 -> "12" -
SHORT_FORMAT
0 -> "01", 1 -> "02", ..., 11 -> "12" -
MEDIUM_FORMAT
0 -> "Jan", 1 -> "Feb", ..., 11 -> "Dec" -
LONG_FORMAT
0 -> "January", 1 -> "February", ..., 11 -> "December"
-
-
Constructor Details
-
MonthNameConverter
public MonthNameConverter()Creates a new CalendarConverter.
-
-
Method Details
-
toString
Description copied from interface:ObjectConverter
Converts from object to String based on current locale.- Specified by:
toString
in interfaceObjectConverter
- Parameters:
object
- object to be convertedcontext
- converter context to be used- Returns:
- the String
-
getCalendarByMonth
-
supportToString
Description copied from interface:ObjectConverter
If it supports toString method.- Specified by:
supportToString
in interfaceObjectConverter
- Parameters:
object
- object to be convertedcontext
- converter context to be used- Returns:
- true if supports toString
-
fromString
Description copied from interface:ObjectConverter
Converts from String to an object.- Specified by:
fromString
in interfaceObjectConverter
- Parameters:
string
- the stringcontext
- context to be converted- Returns:
- the object converted from string
-
supportFromString
Description copied from interface:ObjectConverter
If it supports fromString.- Specified by:
supportFromString
in interfaceObjectConverter
- Parameters:
string
- the stringcontext
- context to be converted- Returns:
- true if it supports
-
getDefaultFormat
Gets default format to format a month.- Returns:
- DefaultFormat
-
setDefaultFormat
Sets default format to format a month. Default isMEDIUM_FORMAT
.- Parameters:
defaultFormat
- the default format to format the month.
-
main
-