Package com.globalmentor.model
Class DefaultTypeConverter
java.lang.Object
com.globalmentor.model.DefaultTypeConverter
- All Implemented Interfaces:
TypeConverter
A default implementation of a type converter.
The following types can be converted to the listed types:
- Author:
- Garret Wilson
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DefaultTypeConverter
The default, shared instance of the converter. -
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor; used only for the singleton instance and for extension. -
Method Summary
-
Field Details
-
INSTANCE
The default, shared instance of the converter.
-
-
Constructor Details
-
DefaultTypeConverter
protected DefaultTypeConverter()Default constructor; used only for the singleton instance and for extension.
-
-
Method Details
-
convert
Description copied from interface:TypeConverter
Converts an object from one type to another. If the object is already of the correct type, no action occurs.- Specified by:
convert
in interfaceTypeConverter
- Type Parameters:
T
- The type of object required.- Parameters:
object
- The object to convert.requiredType
- The class representing required type of the object.- Returns:
- The object as the required type, or
null
if the object cannot be converted to the required type. - Throws:
IllegalArgumentException
- if the given object should be able to be converted to the required type but something about its state, format, or contents prevented the conversion.
-