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 DateFormat0 -> "1", 1 -> "2", ..., 11 -> "12"static ConverterContextDefault ConverterContext for MonthConverter.static final DateFormat0 -> "January", 1 -> "February", ..., 11 -> "December"static final DateFormat0 -> "Jan", 1 -> "Feb", ..., 11 -> "Dec"static final DateFormat0 -> "01", 1 -> "02", ..., 11 -> "12" -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromString(String string, ConverterContext context) Converts from String to an object.protected CalendargetCalendarByMonth(int month) Gets default format to format a month.static voidvoidsetDefaultFormat(DateFormat defaultFormat) Sets default format to format a month.booleansupportFromString(String string, ConverterContext context) If it supports fromString.booleansupportToString(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:ObjectConverterConverts from object to String based on current locale.- Specified by:
toStringin interfaceObjectConverter- Parameters:
object- object to be convertedcontext- converter context to be used- Returns:
- the String
-
getCalendarByMonth
-
supportToString
Description copied from interface:ObjectConverterIf it supports toString method.- Specified by:
supportToStringin interfaceObjectConverter- Parameters:
object- object to be convertedcontext- converter context to be used- Returns:
- true if supports toString
-
fromString
Description copied from interface:ObjectConverterConverts from String to an object.- Specified by:
fromStringin interfaceObjectConverter- Parameters:
string- the stringcontext- context to be converted- Returns:
- the object converted from string
-
supportFromString
Description copied from interface:ObjectConverterIf it supports fromString.- Specified by:
supportFromStringin 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
-