|
|||||||||
| Home >> All >> org >> cantaloop >> tools >> [ conversion overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.cantaloop.tools.conversion
Interface Converter

- All Known Implementing Classes:
- AbstractConverter, IdenticalConverter, UnmodifiableConverter
- public interface Converter
Classes implementing this interface convert certain input objects
to objects representing the same value (regarding certain aspects)
but are instances of a different class.
Converters that can or have to be configured may provide set
methods for these configuration parameters. In any case the converter
needs a zero argument constructor.
For example a Converter could convert a
String with the value 2001.12.11 to a
object of type java.util.Date that represents this
date.
- Version:
- @version@ ($Revision: 1.3 $)
| Method Summary | |
java.lang.Object |
convert(java.lang.Object o,
java.lang.Class type)
Converts the input object to the desired output type as long as the input object is an instance of one of the classes in the getInputtypes and the output type or a subtype
is contained in getOutputTypes.If the desired output type is a supertype of more than one of the output types, one of these subtype will be chosen (the choice may be random). |
java.util.Set |
getInputTypes()
Returns a set containing the classes that are supported as input types. |
java.util.Set |
getOutputTypes()
Returns a set containing the classes that are supported as output types. |
| Method Detail |
getInputTypes
public java.util.Set getInputTypes()
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 containsjava.util.List.class, any class that implementsjava.util.Listmust be supported.Note:
nullis never a valid input type.
getOutputTypes
public java.util.Set getOutputTypes()
- 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.
convert
public java.lang.Object convert(java.lang.Object o, java.lang.Class type) throws ConversionException
- Converts the input object to the desired output type as long as
the input object is an instance of one of the classes in the
getInputtypesand the output type or a subtype is contained ingetOutputTypes.
If the desired output type is a supertype of more than one of the output types, one of these subtype will be chosen (the choice may be random).
|
|||||||||
| Home >> All >> org >> cantaloop >> tools >> [ conversion overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC