final class TypeTokenStringConverter extends AbstractTypeStringConverter implements TypedStringConverter<com.google.common.reflect.TypeToken<?>>
This is loaded by reflection only when Guava is on the classpath. It relies on internal methods in Guava that could change in any release.
This parser is incomplete, but handles common cases. It does not handle union types or multi-dimensional arrays.
| Constructor and Description |
|---|
TypeTokenStringConverter() |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.reflect.TypeToken<?> |
convertFromString(java.lang.Class<? extends com.google.common.reflect.TypeToken<?>> cls,
java.lang.String str)
Converts the specified object from a
String. |
java.lang.String |
convertToString(com.google.common.reflect.TypeToken<?> object)
Converts the specified object to a
String. |
java.lang.Class<?> |
getEffectiveType()
Gets the effective type that the converter works on.
|
parsepublic java.lang.String convertToString(com.google.common.reflect.TypeToken<?> object)
ToStringConverterString.convertToString in interface ToStringConverter<com.google.common.reflect.TypeToken<?>>object - the object to convert, not nullpublic com.google.common.reflect.TypeToken<?> convertFromString(java.lang.Class<? extends com.google.common.reflect.TypeToken<?>> cls,
java.lang.String str)
FromStringConverterString.convertFromString in interface FromStringConverter<com.google.common.reflect.TypeToken<?>>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<com.google.common.reflect.TypeToken<?>>