Top Description Fields Constructors Methods
org.joda.convert

pack-priv final Class AnnotationStringConverterFactory

extends Object
implements StringConverterFactory
Class Inheritance
All Implemented Interfaces
org.joda.convert.StringConverterFactory
Imports
java.lang.reflect.Constructor, .Method

Factory for StringConverter looking up annotations.

This class is immutable and thread-safe.

Since
1.5

Field Summary

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

Singleton instance.

Constructor Summary

AccessConstructor and Description
private
AnnotationStringConverterFactory()

Restricted constructor.

Method Summary

Modifier and TypeMethod and Description
private Class<?>
private <
the type of the converter
T
>
StringConverter<T>

Returns:

the converter, not null
findAnnotatedConverter
(Class<T>
the class to find a method for, not null
cls
)

Finds a converter searching annotated.

private <
the type of the converter
T
>
TypedFromStringConverter<T>

Returns:

the converter, null if not found
findAnnotatedFromStringConverter
(Class<T>
the class to find a method for, not null
cls
)

Finds a from-string converter.

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.
private Method

Returns:

the method to call, null means not found
findFromString
(Class<?>
the class to find a method for, not null
cls
)

Finds the conversion method.

private <
the type of the converter
T
>
TypedFromStringConverter<T>

Returns:

the method to call, null means none found
findFromStringConstructor
(Class<T>
the class to find a method for, not null
cls
)

Finds the conversion method.

pack-priv <
the type of the converter
T
>
TypedFromStringConverter<T>

Returns:

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

Finds a from-string converter by type.

private <T> TypedFromStringConverter<T>

Returns:

the method to call, null means not found
findFromStringMethod
(Class<T>
the class to find a method for, not null
cls
,
boolean
whether to search superclasses
searchSuperclasses
)

Finds the conversion method.

private Method

Returns:

the method to call, null means use toString
findToStringMethod
(Class<?>
the class to find a method for, not null
cls
)

Finds the conversion method.

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 AnnotationStringConverterFactory INSTANCE

Singleton instance.

Constructor Detail

AnnotationStringConverterFactoryback to summary
private AnnotationStringConverterFactory()

Restricted constructor.

Method Detail

eliminateEnumSubclassback to summary
private Class<?> eliminateEnumSubclass(Class<?> cls)
findAnnotatedConverterback to summary
private <T> StringConverter<T> findAnnotatedConverter(Class<T> cls)

Finds a converter searching annotated.

Parameters
<T>
the type of the converter
cls:Class<T>

the class to find a method for, not null

Returns:StringConverter<T>

the converter, not null

Exceptions
RuntimeException:
if none found
findAnnotatedFromStringConverterback to summary
private <T> TypedFromStringConverter<T> findAnnotatedFromStringConverter(Class<T> cls)

Finds a from-string converter.

Parameters
<T>
the type of the converter
cls:Class<T>

the class to find a method for, not null

Returns:TypedFromStringConverter<T>

the converter, null if not found

Exceptions
RuntimeException:
if none found
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
findFromStringback to summary
private Method findFromString(Class<?> cls)

Finds the conversion method.

Parameters
cls:Class<?>

the class to find a method for, not null

Returns:Method

the method to call, null means not found

Exceptions
RuntimeException:
if invalid
findFromStringConstructorback to summary
private <T> TypedFromStringConverter<T> findFromStringConstructor(Class<T> cls)

Finds the conversion method.

Parameters
<T>
the type of the converter
cls:Class<T>

the class to find a method for, not null

Returns:TypedFromStringConverter<T>

the method to call, null means none found

Exceptions
RuntimeException:
if invalid
findFromStringConverterback to summary
pack-priv <T> TypedFromStringConverter<T> findFromStringConverter(Class<T> cls)

Finds a from-string converter by type.

Parameters
<T>
the type of the converter
cls:Class<T>

the type to lookup, not null

Returns:TypedFromStringConverter<T>

the converter, null if not found

Exceptions
RuntimeException:
(or subclass) if source code is invalid
findFromStringMethodback to summary
private <T> TypedFromStringConverter<T> findFromStringMethod(Class<T> cls, boolean searchSuperclasses)

Finds the conversion method.

Parameters
cls:Class<T>

the class to find a method for, not null

searchSuperclasses:boolean

whether to search superclasses

Returns:TypedFromStringConverter<T>

the method to call, null means not found

Exceptions
RuntimeException:
if invalid
findToStringMethodback to summary
private Method findToStringMethod(Class<?> cls)

Finds the conversion method.

Parameters
cls:Class<?>

the class to find a method for, not null

Returns:Method

the method to call, null means use toString

Exceptions
RuntimeException:
if 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