Top Description Fields Constructors Methods
org.joda.convert

pack-priv final Class ConstructorFromStringConverter<T>

extends Object
implements TypedFromStringConverter<T>
Class Inheritance
All Implemented Interfaces
org.joda.convert.TypedFromStringConverter, org.joda.convert.FromStringConverter
Type Parameters
<T>
the type of the converter
Imports
java.lang.reflect.Constructor, .InvocationTargetException, .Modifier

Conversion from a string using a fromString constructor.

The fromString constructor must take a single String parameter.

ConstructorFromStringConverter is thread-safe and immutable.

Field Summary

Modifier and TypeField and Description
private final Constructor<T>
fromString

Conversion from a string.

Constructor Summary

AccessConstructor and Description
pack-priv
ConstructorFromStringConverter(Class<T>
the class this converts for, not null
cls
,
Constructor<T>
the fromString method, not null
fromString
)

Creates an instance using a method and a constructor.

Method Summary

Modifier and TypeMethod and Description
public T
convertFromString(Class<? extends T>
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 Class<?>
getEffectiveType()

Implements org.joda.convert.TypedFromStringConverter.getEffectiveType.

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

Field Detail

fromStringback to summary
private final Constructor<T> fromString

Conversion from a string.

Constructor Detail

ConstructorFromStringConverterback to summary
pack-priv ConstructorFromStringConverter(Class<T> cls, Constructor<T> fromString)

Creates an instance using a method and a constructor.

Parameters
cls:Class<T>

the class this converts for, not null

fromString:Constructor<T>

the fromString method, not null

Exceptions
RuntimeException:
(or subclass) if the method signatures are invalid

Method Detail

convertFromStringback to summary
public T convertFromString(Class<? extends T> 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 T>

the class to convert to, not null

str:String

the string to convert, not null

Returns:T

the converted object, may be null but generally not

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

Implements org.joda.convert.TypedFromStringConverter.getEffectiveType.

Doc from org.joda.convert.TypedFromStringConverter.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