|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.twelvemonkeys.util.convert.DefaultConverter
public final class DefaultConverter
Converts strings to objects and back.
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 Summary | |
|---|---|
DefaultConverter()
Creates a DefaultConverter. |
|
| Method Summary | |
|---|---|
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(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultConverter()
DefaultConverter.
| Method Detail |
|---|
public Object toObject(String pString,
Class pType,
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 String toString(Object pObject,
String pFormat)
throws ConversionException
pObject.toString().
toString in interface PropertyConverterpObject - the object to convert.pFormat - ignored.
null if pObject == null
ConversionException - if the string could not be converted to the
specified type and format.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||