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 final Class | cls
The converted class. |
| pack-priv final TypedFromStringConverter | fromString
Conversion from a string, package-scoped for testing. |
| private final Method | toString
Conversion to a string. |
| Access | Constructor and Description |
|---|---|
| pack-priv | ReflectionStringConverter(Class<T>
the class this converts for, null creates a from-string converter cls, Method the toString method, not null toString, TypedFromStringConverter<T> the fromString converter, not null fromString)Creates an instance using two methods. |
| Modifier and Type | Method and Description |
|---|---|
| public T | convertFromString(Class<? extends T>
the class to convert to, not null cls, String the string to convert, not null str)Implements org. String.
|
| public String | convertToString(T
the object to convert, not null object)Implements org. String.
|
| public Class | getEffectiveType()
Implements org. |
| public String |
| cls | back to summary |
|---|---|
| private final Class<T> cls The converted class. | |
| fromString | back to summary |
|---|---|
| pack-priv final TypedFromStringConverter<T> fromString Conversion from a string, package-scoped for testing. | |
| toString | back to summary |
|---|---|
| private final Method toString Conversion to a string. | |
| ReflectionStringConverter | back to summary |
|---|---|
| pack-priv ReflectionStringConverter(Class<T> cls, Method toString, TypedFromStringConverter<T> fromString) Creates an instance using two methods.
| |
| convertFromString | back to summary |
|---|---|
| public T convertFromString(Class<? extends T> cls, String str) Implements org. Doc from org. Converts the specified object from a | |
| convertToString | back to summary |
|---|---|
| public String convertToString(T object) Implements org. Doc from org. Converts the specified object to a | |
| getEffectiveType | back to summary |
|---|---|
| public Class Implements org. Doc from org. Gets the effective type that the converter works on.
For example, if a class declares the | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |