java.lang.Object
org.cantaloop.tools.conversion.AbstractConverter
- All Implemented Interfaces:
- Converter
- Direct Known Subclasses:
- CollectionConverter, DateConverter, DateFormatter, IntegerConverter, IntegerLiteralConverter, IntLiteralConverter, LinkedConverter, SetConverter, SetLiteralConverter, StringConverter, StringLiteralConverter
- public abstract class AbstractConverter
- extends java.lang.Object
- implements Converter
AbstractConverter.java
- Version:
- @version@ ($Revision: 1.6 $)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.cantaloop.tools.conversion.Converter |
convert |
m_inputTypes
protected java.util.Set m_inputTypes
m_outputTypes
protected java.util.Set m_outputTypes
m_canConvertNull
private boolean m_canConvertNull
AbstractConverter
protected AbstractConverter(java.lang.Class input,
java.lang.Class output)
AbstractConverter
protected AbstractConverter(java.lang.Class input,
java.lang.Class output,
boolean canConvertNull)
AbstractConverter
protected AbstractConverter(java.lang.Class[] input,
java.lang.Class[] output)
AbstractConverter
protected AbstractConverter(java.lang.Class[] input,
java.lang.Class[] output,
boolean canConvertNull)
AbstractConverter
protected AbstractConverter(java.util.Set sin,
java.util.Set sout)
checkTypes
protected final java.lang.Class checkTypes(java.lang.Object obj,
java.lang.Class type)
throws ConversionException
- Checks if
obj can converted to
type. Subclasses should call this method
from the convert method before performing the conversion.
It also chooses the appropriate type if type is not
contained in the output types but a supertype of it.
throwException
protected final void throwException(java.lang.Object o,
java.lang.Class type)
throws ConversionException
- Throws a generic
ConversionException. Subclasses
should only use this methods if no other information about
the failure of the conversion are available.
Note: The ConversionException is
always thrown.
getInputTypes
public java.util.Set getInputTypes()
- Description copied from interface:
Converter
Returns a set containing the classes that are supported as input
types. Subtypes of these base classes have to be supported, too.
Example:
If the set contains java.util.List.class, any class
that implements java.util.List must be supported.
Note:null is never a valid input type.
- Specified by:
getInputTypes in interface Converter
getOutputTypes
public java.util.Set getOutputTypes()
- Description copied from interface:
Converter
- Returns a set containing the classes that are supported
as output types. It must be possible to convert each of
the input types 55 to each of the
output types.
- Specified by:
getOutputTypes in interface Converter