com.mortbay.Util
Interface Converter

All Known Implementing Classes:
ArrayConverter, ConverterSet, ConverterSet.PrimitiveConverter, DictionaryConverter

public interface Converter

Interface for converting classes


Method Summary
 java.lang.Object convert(java.lang.Object toConvert, java.lang.Class convertTo, Converter context)
          Try to convert a value.
 

Method Detail

convert

public java.lang.Object convert(java.lang.Object toConvert,
                                java.lang.Class convertTo,
                                Converter context)
Try to convert a value. A good check for implementors of this class as a first line is:
 if (toConvert.getClass().equals(convertTo)) return toConvert;
 
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.
Returns:
The converted value, or null if not possible