Package org.joda.convert
Class EnumStringConverterFactory.EnumStringConverter
- java.lang.Object
-
- org.joda.convert.EnumStringConverterFactory.EnumStringConverter
-
- All Implemented Interfaces:
FromStringConverter<java.lang.Enum<?>>
,StringConverter<java.lang.Enum<?>>
,ToStringConverter<java.lang.Enum<?>>
,TypedStringConverter<java.lang.Enum<?>>
- Enclosing class:
- EnumStringConverterFactory
final class EnumStringConverterFactory.EnumStringConverter extends java.lang.Object implements TypedStringConverter<java.lang.Enum<?>>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<?>
effectiveType
-
Constructor Summary
Constructors Constructor Description EnumStringConverter(java.lang.Class<?> effectiveType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Enum<?>
convertFromString(java.lang.Class<? extends java.lang.Enum<?>> cls, java.lang.String str)
Converts the specified object from aString
.java.lang.String
convertToString(java.lang.Enum<?> en)
Converts the specified object to aString
.java.lang.Class<?>
getEffectiveType()
Gets the effective type that the converter works on.
-
-
-
Method Detail
-
convertToString
public java.lang.String convertToString(java.lang.Enum<?> en)
Description copied from interface:ToStringConverter
Converts the specified object to aString
.- Specified by:
convertToString
in interfaceToStringConverter<java.lang.Enum<?>>
- Parameters:
en
- the object to convert, not null- Returns:
- the converted string, may be null but generally not
-
convertFromString
public java.lang.Enum<?> convertFromString(java.lang.Class<? extends java.lang.Enum<?>> cls, java.lang.String str)
Description copied from interface:FromStringConverter
Converts the specified object from aString
.- Specified by:
convertFromString
in interfaceFromStringConverter<java.lang.Enum<?>>
- Parameters:
cls
- the class to convert to, not nullstr
- the string to convert, not null- Returns:
- the converted object, may be null but generally not
-
getEffectiveType
public java.lang.Class<?> getEffectiveType()
Description copied from interface:TypedStringConverter
Gets the effective type that the converter works on.For example, if a class declares the
FromString
andToString
then the effective type of the converter is that class. If a subclass is queried for a converter, then the effective type is that of the superclass.- Specified by:
getEffectiveType
in interfaceTypedStringConverter<java.lang.Enum<?>>
- Returns:
- the effective type
-
-