public abstract class Converter extends java.lang.Object implements PropertyConverter
Time, Date
and Object
(the DefaultConverter) are registered by this class' static
initializer. You might remove them using the
unregisterConverter method.registerConverter(Class, PropertyConverter),
unregisterConverter(Class)| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.Class,PropertyConverter> |
converters
The converters Map
|
protected static Converter |
sInstance
Our singleton instance
|
| Modifier | Constructor and Description |
|---|---|
protected |
Converter()
Creates a Converter.
|
| Modifier and Type | Method and Description |
|---|---|
static Converter |
getInstance()
Gets the Converter instance.
|
static void |
registerConverter(java.lang.Class<?> pType,
PropertyConverter pConverter)
Registers a converter for a given type.
|
java.lang.Object |
toObject(java.lang.String pString,
java.lang.Class pType)
Converts the string to an object of the given type.
|
abstract java.lang.Object |
toObject(java.lang.String pString,
java.lang.Class pType,
java.lang.String pFormat)
Converts the string to an object of the given type, parsing after the
given format.
|
java.lang.String |
toString(java.lang.Object pObject)
Converts the object to a string, using
object.toString() |
abstract java.lang.String |
toString(java.lang.Object pObject,
java.lang.String pFormat)
Converts the object to a string, using
object.toString() |
static void |
unregisterConverter(java.lang.Class<?> pType)
Un-registers a converter for a given type.
|
protected static final Converter sInstance
protected final java.util.Map<java.lang.Class,PropertyConverter> converters
public static Converter getInstance()
public static void registerConverter(java.lang.Class<?> pType,
PropertyConverter pConverter)
Time, Date
and Object
(the DefaultConverter) are registered by this class' static
initializer. You might remove them using the
unregisterConverter method.pType - the (super) type to register a converter forpConverter - the converterunregisterConverter(Class)public static void unregisterConverter(java.lang.Class<?> pType)
pType - the (super) type to remove converter forregisterConverter(Class,PropertyConverter)public java.lang.Object toObject(java.lang.String pString,
java.lang.Class pType)
throws ConversionException
pString - the string to convertpType - the type to convert toConversionException - if the string cannot be converted for any
reason.public abstract java.lang.Object toObject(java.lang.String pString,
java.lang.Class pType,
java.lang.String pFormat)
throws ConversionException
toObject in interface PropertyConverterpString - the string to convertpType - the type to convert topFormat - the (optional) conversion formatConversionException - if the string cannot be converted for any
reason.public java.lang.String toString(java.lang.Object pObject)
throws ConversionException
object.toString()pObject - the object to convert.ConversionException - if the object cannot be converted to a
string for any reason.public abstract java.lang.String toString(java.lang.Object pObject,
java.lang.String pFormat)
throws ConversionException
object.toString()toString in interface PropertyConverterpObject - the object to convert.pFormat - the (optional) conversion formatConversionException - if the object cannot be converted to a
string for any reason.Copyright © 2018. All Rights Reserved.