Package org.joda.convert
Class TypeTokenStringConverter
- java.lang.Object
-
- org.joda.convert.AbstractTypeStringConverter
-
- org.joda.convert.TypeTokenStringConverter
-
- All Implemented Interfaces:
FromStringConverter<com.google.common.reflect.TypeToken<?>>
,StringConverter<com.google.common.reflect.TypeToken<?>>
,ToStringConverter<com.google.common.reflect.TypeToken<?>>
,TypedStringConverter<com.google.common.reflect.TypeToken<?>>
final class TypeTokenStringConverter extends AbstractTypeStringConverter implements TypedStringConverter<com.google.common.reflect.TypeToken<?>>
Parse the string format of Guava 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 Summary
Constructors Constructor Description TypeTokenStringConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 aString
.java.lang.String
convertToString(com.google.common.reflect.TypeToken<?> object)
Converts the specified object to aString
.java.lang.Class<?>
getEffectiveType()
Gets the effective type that the converter works on.-
Methods inherited from class org.joda.convert.AbstractTypeStringConverter
parse
-
-
-
-
Method Detail
-
convertToString
public java.lang.String convertToString(com.google.common.reflect.TypeToken<?> object)
Description copied from interface:ToStringConverter
Converts the specified object to aString
.- Specified by:
convertToString
in interfaceToStringConverter<com.google.common.reflect.TypeToken<?>>
- Parameters:
object
- the object to convert, not null- Returns:
- the converted string, may be null but generally not
-
convertFromString
public com.google.common.reflect.TypeToken<?> convertFromString(java.lang.Class<? extends com.google.common.reflect.TypeToken<?>> cls, java.lang.String str)
Description copied from interface:FromStringConverter
Converts the specified object from aString
.- Specified by:
convertFromString
in interfaceFromStringConverter<com.google.common.reflect.TypeToken<?>>
- Parameters:
cls
- the class to convert to, not nullstr
- the string to convert, not null- Returns:
- the converted object, may be null but generally not
-
getEffectiveType
public java.lang.Class<?> getEffectiveType()
Description copied from interface:TypedStringConverter
Gets the effective type that the converter works on.For example, if a class declares the
FromString
andToString
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.- Specified by:
getEffectiveType
in interfaceTypedStringConverter<com.google.common.reflect.TypeToken<?>>
- Returns:
- the effective type
-
-