Top Description Inners Fields Constructors Methods
org.joda.convert

pack-priv final Class EnumStringConverterFactory

extends Object
implements StringConverterFactory
Class Inheritance
All Implemented Interfaces
org.joda.convert.StringConverterFactory

Factory for StringConverter looking up enums.

This class is immutable and thread-safe.

Since
1.7

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final StringConverterFactory
INSTANCE

Singleton instance.

Constructor Summary

AccessConstructor and Description
private
EnumStringConverterFactory()

Restricted constructor.

Method Summary

Modifier and TypeMethod and Description
public StringConverter<?>

Returns:

the converter, null if not found
findConverter
(Class<?>
the type to lookup, not null
cls
)

Implements org.joda.convert.StringConverterFactory.findConverter.

Finds a converter by type.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final StringConverterFactory INSTANCE

Singleton instance.

Constructor Detail

EnumStringConverterFactoryback to summary
private EnumStringConverterFactory()

Restricted constructor.

Method Detail

findConverterback to summary
public StringConverter<?> findConverter(Class<?> cls)

Implements org.joda.convert.StringConverterFactory.findConverter.

Finds a converter by type.

Parameters
cls:Class<?>

the type to lookup, not null

Returns:StringConverter<?>

the converter, null if not found

Annotations
@Override
Exceptions
RuntimeException:
(or subclass) if source code is invalid
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.joda.convert back to summary

pack-priv final Class EnumStringConverterFactory.EnumStringConverter

extends Object
implements TypedStringConverter<Enum<?>>
Class Inheritance
  • java.lang.Object
  • org.joda.convert.EnumStringConverterFactory.EnumStringConverter
All Implemented Interfaces
org.joda.convert.TypedStringConverter, org.joda.convert.TypedFromStringConverter, org.joda.convert.FromStringConverter, org.joda.convert.StringConverter, org.joda.convert.ToStringConverter

Field Summary

Modifier and TypeField and Description
private final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv
EnumStringConverter(Class<?> effectiveType)

Method Summary

Modifier and TypeMethod and Description
public Enum<?>
convertFromString(Class<? extends Enum<?>>
the class to convert to, not null
cls
,
String
the string to convert, not null
str
)

Implements org.joda.convert.FromStringConverter.convertFromString.

Converts the specified object from a String.
public String
convertToString(Enum<?>
the object to convert, not null
en
)

Implements org.joda.convert.ToStringConverter.convertToString.

Converts the specified object to a String.
public Class<?>
getEffectiveType()

Implements org.joda.convert.TypedStringConverter.getEffectiveType.

Gets the effective type that the converter works on.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

effectiveTypeback to summary
private final Class<?> effectiveType

Constructor Detail

EnumStringConverterback to summary
pack-priv EnumStringConverter(Class<?> effectiveType)

Method Detail

convertFromStringback to summary
public Enum<?> convertFromString(Class<? extends Enum<?>> cls, String str)

Implements org.joda.convert.FromStringConverter.convertFromString.

Doc from org.joda.convert.FromStringConverter.convertFromString.

Converts the specified object from a String.

Parameters
cls:Class<? extends Enum<?>>

the class to convert to, not null

str:String

the string to convert, not null

Returns:Enum<?>

the converted object, may be null but generally not

Annotations
@Override
@SuppressWarnings:unchecked, rawtypes
convertToStringback to summary
public String convertToString(Enum<?> en)

Implements org.joda.convert.ToStringConverter.convertToString.

Doc from org.joda.convert.ToStringConverter.convertToString.

Converts the specified object to a String.

Parameters
en:Enum<?>

the object to convert, not null

Returns:String

the converted string, may be null but generally not

Annotations
@Override
getEffectiveTypeback to summary
public Class<?> getEffectiveType()

Implements org.joda.convert.TypedStringConverter.getEffectiveType.

Doc from org.joda.convert.TypedStringConverter.getEffectiveType.

Gets the effective type that the converter works on.

For example, if a class declares the FromString and ToString 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.

Returns:Class<?>

the effective type

Annotations
@Override