|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.binding.convert.support.GenericConversionService
public class GenericConversionService
Base implementation of a conversion service. Initially empty, e.g. no converters are registered by default.
Constructor Summary | |
---|---|
GenericConversionService()
|
Method Summary | |
---|---|
void |
addAlias(java.lang.String alias,
java.lang.Class targetType)
Add an alias for given target type. |
void |
addConverter(Converter converter)
Add given converter to this conversion service. |
void |
addConverter(Converter converter,
java.lang.String alias)
Add given converter with an alias to the conversion service. |
void |
addConverters(Converter[] converters)
Add all given converters. |
void |
addDefaultAlias(java.lang.Class targetType)
Generate a conventions based alias for given target type. |
protected java.util.Map |
getAliasMap()
Returns a map of known aliases. |
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 alias)
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 . |
ConversionService |
getParent()
Returns the parent of this conversion service. |
protected java.util.Map |
getSourceClassConverters()
Returns an indexed map of converters. |
void |
setParent(ConversionService parent)
Set the parent of this conversion service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericConversionService()
Method Detail |
---|
public ConversionService getParent()
public void setParent(ConversionService parent)
public void addConverter(Converter converter)
ConversionServiceAware
, it will get
the conversion service injected.
public void addConverters(Converter[] converters)
ConversionServiceAware
, they will get the conversion
service injected.
public void addConverter(Converter converter, java.lang.String alias)
ConversionServiceAware
,
it will get the conversion service injected.
public void addAlias(java.lang.String alias, java.lang.Class targetType)
public void addDefaultAlias(java.lang.Class targetType)
public ConversionExecutor getConversionExecutor(java.lang.Class sourceClass, java.lang.Class targetClass) throws ConversionException
ConversionService
sourceClass
to instances of the targetClass
.
The returned ConversionExecutor is thread-safe and may safely be cached for use in client code.
getConversionExecutor
in interface ConversionService
sourceClass
- the source class to convert fromtargetClass
- the target class to convert to
ConversionException
- an exception occured retrieving a converter for the source-to-target pairpublic ConversionExecutor getConversionExecutorByTargetAlias(java.lang.Class sourceClass, java.lang.String alias) throws java.lang.IllegalArgumentException
ConversionService
sourceClass
to target objects of the type associated with the specified alias.
getConversionExecutorByTargetAlias
in interface ConversionService
sourceClass
- the sourceClassalias
- the target alias
java.lang.IllegalArgumentException
public ConversionExecutor[] getConversionExecutorsForSource(java.lang.Class sourceClass)
ConversionService
sourceClass
.
getConversionExecutorsForSource
in interface ConversionService
sourceClass
- the source class to convert from
public java.lang.Class getClassByAlias(java.lang.String alias)
ConversionService
getClassByAlias
in interface ConversionService
alias
- the class alias
protected java.util.Map getSourceClassConverters()
protected java.util.Map getAliasMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |