org.springframework.binding.convert
Interface Converter

All Known Implementing Classes:
AbstractConverter, AbstractFormattingConverter, ConversionServiceAwareConverter, TextToBoolean, TextToClass, TextToExpression, TextToLabeledEnum, TextToMethodSignature, TextToNumber

public interface Converter

A type converter converts objects from one type to another. They may support conversion of multiple source types to multiple target types.

Implementations of this interface are thread-safe.

Author:
Keith Donald

Method Summary
 java.lang.Object convert(java.lang.Object source, java.lang.Class targetClass, ConversionContext context)
          Convert the provided source object argument to an instance of the specified target class.
 java.lang.Class[] getSourceClasses()
          The source classes this converter can convert from.
 java.lang.Class[] getTargetClasses()
          The target classes this converter can convert to.
 

Method Detail

getSourceClasses

java.lang.Class[] getSourceClasses()
The source classes this converter can convert from.

Returns:
the supported source classes

getTargetClasses

java.lang.Class[] getTargetClasses()
The target classes this converter can convert to.

Returns:
the supported target classes

convert

java.lang.Object convert(java.lang.Object source,
                         java.lang.Class targetClass,
                         ConversionContext context)
                         throws ConversionException
Convert the provided source object argument to an instance of the specified target class.

Parameters:
source - the source object to convert, its class must be one of the supported sourceClasses
targetClass - the target class to convert the source to, must be one of the supported targetClasses
context - an optional conversion context that may be used to influence the conversion process
Returns:
the converted object, an instance of the target type
Throws:
ConversionException - an exception occured during the conversion


Copyright � 2004-2007. All Rights Reserved.