com.abstractics.utils.converter
Interface ObjectConverter
- All Known Implementing Classes:
- CachingConverterWrapper, ConverterBoolean, ConverterBorder, ConverterCharacter, ConverterColor, ConverterDimension, ConverterFont, ConverterImageIcon, ConverterInsets, ConverterNumber, ConverterRectangle, DefaultingConverterWrapper, UrlConverter
- public interface ObjectConverter
Converter to convert a given object into the class specified by the
getClassToConvertTo() method.
- Version:
- $Id: ObjectConverter.java,v 1.2 2006/03/15 05:37:30 andyman99 Exp $
- Author:
- Andrew Lawrence, Copyright 2006 Abstractics, L.L.C., Licensed under the Apache
License, Version 2.0
getClassToConvertTo
public java.lang.Class getClassToConvertTo()
- Returns:
- The class that this converter converts to
convert
public java.lang.Object convert(java.lang.Object obj,
java.util.Locale locale)
throws ObjectConverterException
- Parameters:
obj - Object to be converted. Guaranteed not to be null and not to
already be an instanceof the Class returned by
getClassToConvertTo(). Those conditions are checked
before the converter is even called.locale - The locale that is asking for the conversion. This may or may
not be necessary for the conversion.
- Returns:
- The converted object - should NEVER return anything that is not
an instanceof the class returned by
getClassToConvertTo()
- Throws:
ObjectConverterException - Throw this exception if the string cannot be converted, for
whatever reason.