|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ConversionService
The conversion service is responsible for converting values from
one data type to another.
The service can be enhances by adding ConversionInitializer
s to it.
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. |
|
|
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. |
Method Detail |
---|
void add(java.lang.ClassLoader... classLoaders) throws java.lang.IllegalArgumentException
ConversionInitializer
s, one class name per line.
classLoaders
- the class loaders
java.lang.IllegalArgumentException
- if a class could not be instantiatedvoid add(java.lang.Class<? extends ConversionInitializer> initializerClass) throws java.lang.IllegalArgumentException
initializerClass
- the class
java.lang.IllegalArgumentException
- if the class could not be instantiatedvoid add(ConversionInitializer initializer)
initializer
- the initializer<SOURCE,TARGET> void add(java.lang.Class<SOURCE> sourceType, java.lang.Class<TARGET> targetType, Conversion<SOURCE,TARGET> conversion)
SOURCE
- the source typeTARGET
- the target typesourceType
- the source typetargetType
- the target typeconversion
- the conversion<SOURCE,TARGET> TARGET convey(SOURCE value, java.lang.Class<TARGET> targetType) throws ConversionException
SOURCE
- the source typeTARGET
- the target typevalue
- the value, may be nulltargetType
- the target type
ConversionException
- if something went wrong during converting<SOURCE,TARGET> TARGET convert(SOURCE value, java.lang.Class<TARGET> targetType) throws ConversionException
SOURCE
- the source typeTARGET
- the target typevalue
- the value, may be nulltargetType
- the target type
ConversionException
- if something went wrong during converting<SOURCE,TARGET> boolean isConvertable(java.lang.Class<SOURCE> sourceType, java.lang.Class<TARGET> targetType)
SOURCE
- the source typeTARGET
- the target typesourceType
- the source typetargetType
- the target type
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |