Class ConverterImpl
java.lang.Object
com.twelvemonkeys.util.convert.Converter
com.twelvemonkeys.util.convert.ConverterImpl
- All Implemented Interfaces:
PropertyConverter
The converter (singleton). Converts strings to objects and back.
This is the entrypoint to the converter framework.
- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java#1 $
- See Also:
-
Field Summary
Fields inherited from class Converter
converters, sInstance -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate PropertyConvertergetConverterForType(Class pType) Gets the registered converter for the given type.Converts the string to an object of the given type, parsing after the given format.Converts the object to a string, usingobject.toString()Methods inherited from class Converter
getInstance, registerConverter, toObject, toString, unregisterConverter
-
Constructor Details
-
ConverterImpl
ConverterImpl()Creates a Converter.
-
-
Method Details
-
getConverterForType
Gets the registered converter for the given type.- Parameters:
pType- the type to convert to- Returns:
- an instance of a
PropertyConverterornull
-
toObject
Converts the string to an object of the given type, parsing after the given format.- Specified by:
toObjectin interfacePropertyConverter- Specified by:
toObjectin classConverter- Parameters:
pString- the string to convertpType- the type to convert topFormat- the vonversion format- Returns:
- the object created from the given string.
- Throws:
ConversionException- if the string cannot be converted for any reason.
-
toString
Converts the object to a string, usingobject.toString()- Specified by:
toStringin interfacePropertyConverter- Specified by:
toStringin classConverter- Parameters:
pBean- the object to convertpFormat- the conversion format- Returns:
- the string representation of the object, on the correct format.
- Throws:
ConversionException- if the object cannot be converted to a string for any reason.
-