public final class DefaultConverter extends java.lang.Object implements PropertyConverter
This converter first tries to create an object, using the class' single
string argument constructor (<type>(String)) if found,
otherwise, an attempt to call
the class' static valueOf(String) method. If both fails, a
ConversionException is thrown.
| Constructor and Description |
|---|
DefaultConverter()
Creates a
DefaultConverter. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
java.lang.String |
toString(java.lang.Object pObject,
java.lang.String pFormat)
Converts the object to a string, using
pObject.toString(). |
public 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 - ignored.ConversionException - if the type is null, or if the string cannot
be converted into the given type, using a string constructor or static
valueOf method.public java.lang.String toString(java.lang.Object pObject,
java.lang.String pFormat)
throws ConversionException
pObject.toString().toString in interface PropertyConverterpObject - the object to convert.pFormat - ignored.null if pObject == nullConversionException - if the string could not be converted to the
specified type and format.Copyright © 2020. All Rights Reserved.