: Class ConverterSet

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 ConverterSet

    java.lang.Object
      |
      +--com.mortbay.Util.ConverterBase
            |
            +--com.mortbay.Util.ConverterSet

public class ConverterSet
extends ConverterBase

Class to handle converting of types from one to another. Other Converters can be registered with this ConverterSet and it will try them all in turn until it finds one that works. This class also provides a set of "standard" converters that handle the primitive types, that can be installed by calling registerPrimitiveConverters().

Inner Class Summary
`static class` | `ConverterSet.PrimitiveConverter`

Constructor Summary
`ConverterSet()`

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.
`void` | `register(Converter converter)`
`void` | `registerPrimitiveConverters()` register the standard converters for the primitive types

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

### ConverterSet

    public ConverterSet()

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.

### register

    public void register(Converter converter)

### registerPrimitiveConverters

    public void registerPrimitiveConverters()

  register the standard converters for the primitive types

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