final class AnnotationStringConverterFactory extends java.lang.Object implements StringConverterFactory
StringConverter looking up annotations.
This class is immutable and thread-safe.
| Modifier and Type | Field and Description |
|---|---|
(package private) static StringConverterFactory |
INSTANCE
Singleton instance.
|
| Modifier | Constructor and Description |
|---|---|
private |
AnnotationStringConverterFactory()
Restricted constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.Class<?> |
eliminateEnumSubclass(java.lang.Class<?> cls) |
private <T> StringConverter<T> |
findAnnotatedConverter(java.lang.Class<T> cls)
Finds a converter searching annotated.
|
StringConverter<?> |
findConverter(java.lang.Class<?> cls)
Finds a converter by type.
|
private java.lang.reflect.Method |
findFromString(java.lang.Class<?> cls)
Finds the conversion method.
|
private <T> MethodConstructorStringConverter<T> |
findFromStringConstructor(java.lang.Class<T> cls,
java.lang.reflect.Method toString)
Finds the conversion method.
|
private <T> MethodsStringConverter<T> |
findFromStringMethod(java.lang.Class<T> cls,
java.lang.reflect.Method toString,
boolean searchSuperclasses)
Finds the conversion method.
|
private java.lang.reflect.Method |
findToStringMethod(java.lang.Class<?> cls)
Finds the conversion method.
|
java.lang.String |
toString() |
static final StringConverterFactory INSTANCE
private AnnotationStringConverterFactory()
public StringConverter<?> findConverter(java.lang.Class<?> cls)
findConverter in interface StringConverterFactorycls - the type to lookup, not nulljava.lang.RuntimeException - (or subclass) if source code is invalidprivate <T> StringConverter<T> findAnnotatedConverter(java.lang.Class<T> cls)
T - the type of the convertercls - the class to find a method for, not nulljava.lang.RuntimeException - if none foundprivate java.lang.reflect.Method findToStringMethod(java.lang.Class<?> cls)
cls - the class to find a method for, not nulltoStringjava.lang.RuntimeException - if invalidprivate <T> MethodConstructorStringConverter<T> findFromStringConstructor(java.lang.Class<T> cls, java.lang.reflect.Method toString)
T - the type of the convertercls - the class to find a method for, not nulltoString - the toString method, not nulljava.lang.RuntimeException - if invalidprivate <T> MethodsStringConverter<T> findFromStringMethod(java.lang.Class<T> cls, java.lang.reflect.Method toString, boolean searchSuperclasses)
cls - the class to find a method for, not nulltoString - the toString method, not nullsearchSuperclasses - whether to search superclassesjava.lang.RuntimeException - if invalidprivate java.lang.reflect.Method findFromString(java.lang.Class<?> cls)
cls - the class to find a method for, not nullmatched - the matched method, may be nulljava.lang.RuntimeException - if invalidprivate java.lang.Class<?> eliminateEnumSubclass(java.lang.Class<?> cls)
public java.lang.String toString()
toString in class java.lang.Object