: Class ObjectConverter

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Inner Class Summary
`static interface` | `ObjectConverter.ObjectConvertFail`

Constructor Summary
`ObjectConverter()`

Method Summary
`protected java.lang.Object` | `doConvert(java.lang.Object toConvert, java.lang.Class convertTo, Converter context, boolean safe)` Convert an Object to another type.
`static ObjectConverter.ObjectConvertFail` | `fillObject(java.lang.Object toFill, java.util.Dictionary from, Converter converter, boolean safe)`

Methods inherited from class com.mortbay.Util.ConverterBase
`convert, setTransformMode, unsafeConvert`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ObjectConverter

    public ObjectConverter()

Method Detail

### 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 convert
    `convertTo` - Type to convert to
    `context` - 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)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD