public class ReflectionConverter<S,T> extends Object implements AtomicConverter<S,T>
| Constructor and Description |
|---|
ReflectionConverter(Method accessor,
Constructor<? extends T> constructor) |
| Modifier and Type | Method and Description |
|---|---|
T |
convert(S source,
Converter master,
Context context,
ClassLoader classLoader)
Converts object to target type.
|
static <T> Collection<ReflectionConverter<?,T>> |
discoverConstructorConverters(Class<T> target)
Discovers constructor conversions.
|
Class<S> |
getSourceType() |
Class<? extends T> |
getTargetType() |
String |
toString() |
public ReflectionConverter(Method accessor, Constructor<? extends T> constructor)
accessor - Source object method to invoke to get target type or
constructor parameter for the target type. If it is null, then source itself
is passed to constructor. One of parameters may be null, but not both.constructor - Target class constructor which takes one parameter, either
source type or return type of source type accessor.public T convert(S source, Converter master, Context context, ClassLoader classLoader)
AtomicConverterconvert in interface AtomicConverter<S,T>source - Source object.master - Master converter to delegate conversion
of object parts.public Class<S> getSourceType()
getSourceType in interface AtomicConverter<S,T>public Class<? extends T> getTargetType()
getTargetType in interface AtomicConverter<S,T>public static <T> Collection<ReflectionConverter<?,T>> discoverConstructorConverters(Class<T> target)
target - Target type