org.springframework.binding.convert
Interface ConversionService

All Known Implementing Classes:
CompositeConversionService, DefaultConversionService, GenericConversionService

public interface ConversionService

A service interface for retrieving type conversion executors. The returned command objects are thread-safe and may be safely cached for use by client code.

Author:
Keith Donald

Method Summary
 java.lang.Class getClassByAlias(java.lang.String alias)
          Return the class with the specified alias.
 ConversionExecutor getConversionExecutor(java.lang.Class sourceClass, java.lang.Class targetClass)
          Return a conversion executor command object capable of converting source objects of the specified sourceClass to instances of the targetClass.
 ConversionExecutor getConversionExecutorByTargetAlias(java.lang.Class sourceClass, java.lang.String targetAlias)
          Return a conversion executor command object capable of converting source objects of the specified sourceClass to target objects of the type associated with the specified alias.
 ConversionExecutor[] getConversionExecutorsForSource(java.lang.Class sourceClass)
          Return all conversion executors capable of converting source objects of the the specified sourceClass.
 

Method Detail

getConversionExecutor

ConversionExecutor getConversionExecutor(java.lang.Class sourceClass,
                                         java.lang.Class targetClass)
                                         throws ConversionException
Return a conversion executor command object capable of converting source objects of the specified sourceClass to instances of the targetClass.

The returned ConversionExecutor is thread-safe and may safely be cached for use in client code.

Parameters:
sourceClass - the source class to convert from
targetClass - the target class to convert to
Returns:
the executor that can execute instance conversion, never null
Throws:
ConversionException - an exception occured retrieving a converter for the source-to-target pair

getConversionExecutorByTargetAlias

ConversionExecutor getConversionExecutorByTargetAlias(java.lang.Class sourceClass,
                                                      java.lang.String targetAlias)
                                                      throws ConversionException
Return a conversion executor command object capable of converting source objects of the specified sourceClass to target objects of the type associated with the specified alias.

Parameters:
sourceClass - the sourceClass
targetAlias - the target alias
Returns:
the conversion executor, or null if the alias cannot be found
Throws:
ConversionException - an exception occured retrieving a converter for the source-to-target pair

getConversionExecutorsForSource

ConversionExecutor[] getConversionExecutorsForSource(java.lang.Class sourceClass)
                                                     throws ConversionException
Return all conversion executors capable of converting source objects of the the specified sourceClass.

Parameters:
sourceClass - the source class to convert from
Returns:
the matching conversion executors
Throws:
ConversionException - an exception occured retrieving the converters

getClassByAlias

java.lang.Class getClassByAlias(java.lang.String alias)
                                throws ConversionException
Return the class with the specified alias.

Parameters:
alias - the class alias
Returns:
the class, or null if not aliased
Throws:
ConversionException - when an error occurs looking up the class by alias


Copyright © 2009 Spring Framework. All Rights Reserved.