T
- the type of the converterabstract class ReflectionStringConverter<T> extends java.lang.Object implements TypedStringConverter<T>
The toString method must meet the following signature:
String anyName()
on Class T.
ReflectionStringConverter is abstract, but all known implementations are thread-safe and immutable.
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<T> |
cls
The converted class.
|
private java.lang.reflect.Method |
toString
Conversion to a string.
|
Constructor and Description |
---|
ReflectionStringConverter(java.lang.Class<T> cls,
java.lang.reflect.Method toString)
Creates an instance using two methods.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
convertToString(T object)
Converts the object to a
String . |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEffectiveType
convertFromString
private final java.lang.Class<T> cls
private final java.lang.reflect.Method toString
ReflectionStringConverter(java.lang.Class<T> cls, java.lang.reflect.Method toString)
cls
- the class this converts for, not nulltoString
- the toString method, not nulljava.lang.RuntimeException
- (or subclass) if the method signatures are invalidpublic java.lang.String convertToString(T object)
String
.convertToString
in interface ToStringConverter<T>
object
- the object to convert, not nullpublic java.lang.String toString()
toString
in class java.lang.Object