T
- the type of the converterfinal class TypedAdapter<T> extends java.lang.Object implements TypedStringConverter<T>
StringConverter
to TypedStringConverter
.Modifier and Type | Field and Description |
---|---|
private StringConverter<T> |
conv |
private java.lang.Class<?> |
effectiveType |
Modifier | Constructor and Description |
---|---|
private |
TypedAdapter(StringConverter<T> conv,
java.lang.Class<?> effectiveType) |
Modifier and Type | Method and Description |
---|---|
(package private) static <R> TypedStringConverter<R> |
adapt(java.lang.Class<R> cls,
StringConverter<R> converter) |
T |
convertFromString(java.lang.Class<? extends T> cls,
java.lang.String str)
Converts the specified object from a
String . |
java.lang.String |
convertToString(T object)
Converts the specified object to a
String . |
java.lang.Class<?> |
getEffectiveType()
Gets the effective type that the converter works on.
|
java.lang.String |
toString() |
private final StringConverter<T> conv
private final java.lang.Class<?> effectiveType
private TypedAdapter(StringConverter<T> conv, java.lang.Class<?> effectiveType)
static <R> TypedStringConverter<R> adapt(java.lang.Class<R> cls, StringConverter<R> converter)
public java.lang.String convertToString(T object)
ToStringConverter
String
.convertToString
in interface ToStringConverter<T>
object
- the object to convert, not nullpublic T convertFromString(java.lang.Class<? extends T> cls, java.lang.String str)
FromStringConverter
String
.convertFromString
in interface FromStringConverter<T>
cls
- the class to convert to, not nullstr
- the string to convert, not nullpublic java.lang.Class<?> getEffectiveType()
TypedStringConverter
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.
getEffectiveType
in interface TypedStringConverter<T>
public java.lang.String toString()
toString
in class java.lang.Object