org.apache.commons.convert
Interface Conversion

All Known Implementing Classes:
AbstractConversion, ClassToStringConversion, StringToIntegerConversion

public interface Conversion

Defines a class that can convert one object to an object of another type.

All configuration data for the conversion must be set on the converter separately.

Since:
1.0
Version:
$Id: Conversion.java 155441 2005-02-26 13:19:22Z dirkv $
Author:
Stephen Colebourne

Method Summary
 Object convert(Object value, Converter converter)
          Convert the specified input object into an output object of the another type.
 Class getFromType()
          The type to convert from.
 Class getToType()
          The type to convert to.
 

Method Detail

convert

Object convert(Object value,
               Converter converter)
               throws Exception
Convert the specified input object into an output object of the another type.

Parameters:
value - the value to be converted, read only, may be null
converter - the converter being used, not null
Returns:
the converted value
Throws:
Exception - if conversion fails, use ConversionException if creating a new exception, otherwise just allow exceptions to be thrown

getFromType

Class getFromType()
The type to convert from.

Returns:
the Class object representing the class to convert to

getToType

Class getToType()
The type to convert to.

Returns:
the Class object representing the class to convert from


Copyright © 2003-2010 The Apache Software Foundation. All Rights Reserved.