|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.peaseplate.internal.service.DefaultConversionService
public class DefaultConversionService
The default implementation of the ConversionService
Constructor Summary | |
---|---|
DefaultConversionService()
|
Method Summary | ||
---|---|---|
void |
add(java.lang.Class<? extends ConversionInitializer> initializerClass)
Adds the conversion initializer specified by its class name to the service. |
|
|
add(java.lang.Class<SOURCE> sourceType,
java.lang.Class<TARGET> targetType,
Conversion<SOURCE,TARGET> conversion)
Adds a conversion from the specified source type to the specified target type to the service. |
|
void |
add(java.lang.ClassLoader... classLoaders)
Scans the specified class loaders for conversion service definitions. |
|
void |
add(ConversionInitializer initializer)
Adds the conversions in the conversion initializer to the service. |
|
|
convert(SOURCE value,
java.lang.Class<TARGET> targetType)
Converts the specified value to the specified target type. |
|
|
convey(SOURCE value,
java.lang.Class<TARGET> targetType)
Converts the specified value to the specified target type. |
|
protected
|
get(java.lang.Class<SOURCE> sourceType)
|
|
|
isConvertable(java.lang.Class<SOURCE> sourceType,
java.lang.Class<TARGET> targetType)
Returns true if there is a conversion rule defined for the specified source type and the specified target type. |
|
protected
|
resolve(java.lang.Class<SOURCE> sourceType,
java.lang.Class<TARGET> targetType)
|
|
protected
|
resolveFromInterfaces(java.lang.Class<SOURCE> sourceType)
|
|
protected
|
resolveFromSuperType(java.lang.Class<SOURCE> sourceType)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultConversionService()
Method Detail |
---|
public void add(java.lang.ClassLoader... classLoaders) throws java.lang.IllegalArgumentException
ConversionService
ConversionInitializer
s, one class name per line.
add
in interface ConversionService
classLoaders
- the class loaders
java.lang.IllegalArgumentException
- if a class could not be instantiatedConversionService.add(java.lang.ClassLoader[])
public void add(java.lang.Class<? extends ConversionInitializer> initializerClass) throws java.lang.IllegalArgumentException
ConversionService
add
in interface ConversionService
initializerClass
- the class
java.lang.IllegalArgumentException
- if the class could not be instantiatedConversionService.add(java.lang.Class)
public void add(ConversionInitializer initializer)
ConversionService
add
in interface ConversionService
initializer
- the initializerConversionService.add(org.peaseplate.service.ConversionInitializer)
public <SOURCE,TARGET> void add(java.lang.Class<SOURCE> sourceType, java.lang.Class<TARGET> targetType, Conversion<SOURCE,TARGET> conversion)
ConversionService
add
in interface ConversionService
SOURCE
- the source typeTARGET
- the target typesourceType
- the source typetargetType
- the target typeconversion
- the conversionConversionService.add(java.lang.Class, java.lang.Class, org.peaseplate.lang.Conversion)
protected <SOURCE> ConversionCollection<SOURCE> get(java.lang.Class<SOURCE> sourceType)
public <SOURCE,TARGET> TARGET convey(SOURCE value, java.lang.Class<TARGET> targetType) throws ConversionException
ConversionService
convey
in interface ConversionService
SOURCE
- the source typeTARGET
- the target typevalue
- the value, may be nulltargetType
- the target type
ConversionException
- if something went wrong during convertingConversionService.convey(java.lang.Object, java.lang.Class)
public <SOURCE,TARGET> TARGET convert(SOURCE value, java.lang.Class<TARGET> targetType) throws ConversionException
ConversionService
convert
in interface ConversionService
SOURCE
- the source typeTARGET
- the target typevalue
- the value, may be nulltargetType
- the target type
ConversionException
- if something went wrong during convertingConversionService.convert(java.lang.Object, java.lang.Class)
public <SOURCE,TARGET> boolean isConvertable(java.lang.Class<SOURCE> sourceType, java.lang.Class<TARGET> targetType)
ConversionService
isConvertable
in interface ConversionService
SOURCE
- the source typeTARGET
- the target typesourceType
- the source typetargetType
- the target type
ConversionService.isConvertable(java.lang.Class, java.lang.Class)
protected <SOURCE,TARGET> Conversion<SOURCE,TARGET> resolve(java.lang.Class<SOURCE> sourceType, java.lang.Class<TARGET> targetType)
protected <SOURCE> ConversionCollection<SOURCE> resolveFromSuperType(java.lang.Class<SOURCE> sourceType)
protected <SOURCE> ConversionCollection<SOURCE> resolveFromInterfaces(java.lang.Class<SOURCE> sourceType)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |