com.mortbay.Util
Class ArrayConverter
java.lang.Object
|
+--com.mortbay.Util.ConverterBase
|
+--com.mortbay.Util.ArrayConverter
- public class ArrayConverter
- extends ConverterBase
Class to convert Vectors and Strings to Arrays.
This class will convert Vectors and Strings to arrays. String are
converted by parsing them into elements based on a separator (as passed to
the constructor).
Notes
If unsafeConvert is called, this class will only report errors if the
elements cannot be converted to the component type of the array. The
Exception will be of the ArrayConverter.ArrayConvertFail subtype.
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. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ArrayConverter
public ArrayConverter(java.lang.String separator)
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.