final class TypeStringConverter extends AbstractTypeStringConverter implements TypedStringConverter<java.lang.reflect.Type>
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 |
---|
TypeStringConverter() |
Modifier and Type | Method and Description |
---|---|
java.lang.reflect.Type |
convertFromString(java.lang.Class<? extends java.lang.reflect.Type> cls,
java.lang.String str)
Converts the specified object from a
String . |
java.lang.String |
convertToString(java.lang.reflect.Type object)
Converts the specified object to a
String . |
java.lang.Class<?> |
getEffectiveType()
Gets the effective type that the converter works on.
|
parse
public java.lang.String convertToString(java.lang.reflect.Type object)
ToStringConverter
String
.convertToString
in interface ToStringConverter<java.lang.reflect.Type>
object
- the object to convert, not nullpublic java.lang.reflect.Type convertFromString(java.lang.Class<? extends java.lang.reflect.Type> cls, java.lang.String str)
FromStringConverter
String
.convertFromString
in interface FromStringConverter<java.lang.reflect.Type>
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<java.lang.reflect.Type>