com.mortbay.Util
Class ObjectConverter
java.lang.Object
|
+--com.mortbay.Util.ConverterBase
|
+--com.mortbay.Util.ObjectConverter
- Direct Known Subclasses:
- DictionaryConverter
- public class ObjectConverter
- extends ConverterBase
Class to convert Dictionary's (including PropertyTrees) to complex object
types.
This class tries to convert a Dictionary (Hashtable or Properties etc) to
a complex Object. This is done by iterating over all the public settable
bean Properties and fields of an Object and trying to set them from values
in the Dictionary. Types in the dictionary will be converted using the
context as passed to this Converter, so the user should make sure that
this Converter is part of a ConverterSet capable of handling the required
conversions.
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ObjectConverter
public ObjectConverter()
doConvert
protected java.lang.Object doConvert(java.lang.Object toConvert,
java.lang.Class convertTo,
Converter context,
boolean safe)
- Description copied from class: ConverterBase
- Convert an Object to another type.
- Overrides:
- doConvert in class ConverterBase
- Tags copied from class: ConverterBase
- Parameters:
toConvert
- Value to convertconvertTo
- Type to convert tocontext
- The context within which the converter was called.
If Converters use other Converters, this is passed as
the outermost Converter so that recursive calls have
access to all available Converters. Converter
implementations should pass this if passed null.safe
- If false, errors should be returned.- Returns:
- null if this converter doesn't handle this type to convertTo,
or a ConvertFail exception if there was an error and safe is false.
fillObject
public static ObjectConverter.ObjectConvertFail fillObject(java.lang.Object toFill,
java.util.Dictionary from,
Converter converter,
boolean safe)