public class ConvertingService extends Object
| Modifier and Type | Field and Description |
|---|---|
static Converter |
CONVERTER
Converter which delegates to convert() method.
|
| Constructor and Description |
|---|
ConvertingService() |
| Modifier and Type | Method and Description |
|---|---|
static <S,T> T |
convert(S source,
Class<T> targetType)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> T |
convert(S source,
Class<T> targetType,
ClassLoader classLoader)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> T |
convert(S source,
Class<T> targetType,
Context context)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> T |
convert(S source,
Class<T> targetType,
Context context,
ClassLoader classLoader)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> ConverterClosure<S,T> |
getConverter(Class<S> sourceType,
Class<T> targetType)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> ConverterClosure<S,T> |
getConverter(Class<S> sourceType,
Class<T> targetType,
ClassLoader classLoader)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> ConverterClosure<S,T> |
getConverter(Class<S> sourceType,
Class<T> targetType,
Context context)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
static <S,T> ConverterClosure<S,T> |
getConverter(Class<S> sourceType,
Class<T> targetType,
Context context,
ClassLoader classLoader)
Converts source to target type using Java 6 service loading for AtomicConverterBundle, AtomicConverter, and Converter services
If no converter is found, this method performs converter discovery through
constructors if target type is a class and through duck conversion if target
type is an interface.
|
public ConvertingService()
public static <S,T> T convert(S source, Class<T> targetType) throws ConversionException
convert(source, targetType, false)source - Source object.targetType - Target type.ConversionExceptionpublic static <S,T> T convert(S source, Class<T> targetType, Context context) throws ConversionException
convert(source, targetType, false)source - Source object.targetType - Target type.context - Conversion context.ConversionExceptionpublic static <S,T> T convert(S source, Class<T> targetType, ClassLoader classLoader) throws ConversionException
convert(source, targetType, false)source - Source object.targetType - Target type.classLoader - Class loader, source of converters.ConversionExceptionpublic static <S,T> T convert(S source, Class<T> targetType, Context context, ClassLoader classLoader) throws ConversionException
source - Source object.targetType - Target type.context - Conversion context.classLoader - Class loader.ConversionExceptionpublic static <S,T> ConverterClosure<S,T> getConverter(Class<S> sourceType, Class<T> targetType)
sourceType - Source type.targetType - Target type.ConversionExceptionpublic static <S,T> ConverterClosure<S,T> getConverter(Class<S> sourceType, Class<T> targetType, ClassLoader classLoader)
sourceType - Source type.targetType - Target type.classLoader - Class loader to retrieve converters from.ConversionExceptionpublic static <S,T> ConverterClosure<S,T> getConverter(Class<S> sourceType, Class<T> targetType, Context context)
sourceType - Source type.targetType - Target type.context - Conversion context.ConversionExceptionpublic static <S,T> ConverterClosure<S,T> getConverter(Class<S> sourceType, Class<T> targetType, Context context, ClassLoader classLoader)
sourceType - Source type.targetType - Target type.context - Conversion context.classLoader - Class loader to retrieve converters from.ConversionException