public final class DefaultConverter extends Object implements PropertyConverter
<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 |
---|---|
Object |
toObject(String pString,
Class pType,
String pFormat)
Converts the string to an object of the given type.
|
String |
toString(Object pObject,
String pFormat)
Converts the object to a string, using
pObject.toString() . |
public Object toObject(String pString, Class pType, String pFormat) throws ConversionException
toObject
in interface PropertyConverter
pString
- 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 String toString(Object pObject, String pFormat) throws ConversionException
pObject.toString()
.toString
in interface PropertyConverter
pObject
- the object to convert.pFormat
- ignored.null
if pObject == null
ConversionException
- if the string could not be converted to the
specified type and format.Copyright © 2017. All rights reserved.