Top Description Inners Fields Constructors Methods
org.joda.convert

pack-priv final Class TypeStringConverterFactory

extends Object
implements StringConverterFactory
Class Inheritance
All Implemented Interfaces
org.joda.convert.StringConverterFactory
Imports
java.lang.reflect.Type

Factory for StringConverter looking up types.

This class is immutable and thread-safe.

This parses the string format of Type.

This is achieved thanks to some code copied from Guava. (A Guava dependency is painful when building a Java 6 library for Java 9)

This parser is incomplete, but handles common cases. It does not handle union types or multi-dimensional arrays.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final TypeStringConverterFactory
INSTANCE

Singleton instance.

Constructor Summary

AccessConstructor and Description
private
TypeStringConverterFactory()

Restricted constructor.

Method Summary

Modifier and TypeMethod and Description
public StringConverter<?>

Returns:

the converter, null if not found
findConverter
(Class<?>
the type to lookup, not null
cls
)

Implements org.joda.convert.StringConverterFactory.findConverter.

Finds a converter by type.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

INSTANCEback to summary
pack-priv static final TypeStringConverterFactory INSTANCE

Singleton instance.

Constructor Detail

TypeStringConverterFactoryback to summary
private TypeStringConverterFactory()

Restricted constructor.

Method Detail

findConverterback to summary
public StringConverter<?> findConverter(Class<?> cls)

Implements org.joda.convert.StringConverterFactory.findConverter.

Finds a converter by type.

Parameters
cls:Class<?>

the type to lookup, not null

Returns:StringConverter<?>

the converter, null if not found

Annotations
@Override
Exceptions
RuntimeException:
(or subclass) if source code is invalid
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.joda.convert back to summary

pack-priv final Class TypeStringConverterFactory.TypeStringConverter

extends Object
implements TypedStringConverter<Type>
Class Inheritance
  • java.lang.Object
  • org.joda.convert.TypeStringConverterFactory.TypeStringConverter
All Implemented Interfaces
org.joda.convert.TypedStringConverter, org.joda.convert.TypedFromStringConverter, org.joda.convert.FromStringConverter, org.joda.convert.StringConverter, org.joda.convert.ToStringConverter

Field Summary

Modifier and TypeField and Description
private final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv
TypeStringConverter(Class<?> effectiveType)

Method Summary

Modifier and TypeMethod and Description
public Type
convertFromString(Class<? extends Type>
the class to convert to, not null
cls
,
String
the string to convert, not null
str
)

Implements org.joda.convert.FromStringConverter.convertFromString.

Converts the specified object from a String.
public String
convertToString(Type
the object to convert, not null
type
)

Implements org.joda.convert.ToStringConverter.convertToString.

Converts the specified object to a String.
public Class<?>
getEffectiveType()

Implements org.joda.convert.TypedStringConverter.getEffectiveType.

Gets the effective type that the converter works on.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

effectiveTypeback to summary
private final Class<?> effectiveType

Constructor Detail

TypeStringConverterback to summary
pack-priv TypeStringConverter(Class<?> effectiveType)

Method Detail

convertFromStringback to summary
public Type convertFromString(Class<? extends Type> cls, String str)

Implements org.joda.convert.FromStringConverter.convertFromString.

Doc from org.joda.convert.FromStringConverter.convertFromString.

Converts the specified object from a String.

Parameters
cls:Class<? extends Type>

the class to convert to, not null

str:String

the string to convert, not null

Returns:Type

the converted object, may be null but generally not

Annotations
@Override
convertToStringback to summary
public String convertToString(Type type)

Implements org.joda.convert.ToStringConverter.convertToString.

Doc from org.joda.convert.ToStringConverter.convertToString.

Converts the specified object to a String.

Parameters
type:Type

the object to convert, not null

Returns:String

the converted string, may be null but generally not

Annotations
@Override
getEffectiveTypeback to summary
public Class<?> getEffectiveType()

Implements org.joda.convert.TypedStringConverter.getEffectiveType.

Doc from org.joda.convert.TypedStringConverter.getEffectiveType.

Gets the effective type that the converter works on.

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.

Returns:Class<?>

the effective type

Annotations
@Override