SOURCE
- is the generic source-type
.TARGET
- is the generic target-type
.public abstract class AbstractValueConverter<SOURCE,TARGET> extends AbstractLoggableComponent implements ValueConverter<SOURCE,TARGET>
ValueConverter
interface.Modifier and Type | Field and Description |
---|---|
private ReflectionUtil |
reflectionUtil |
Constructor and Description |
---|
AbstractValueConverter()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
<T extends TARGET> |
convert(SOURCE value,
Object valueSource,
Class<T> targetClass)
This method converts the given
pojo to the <TARGET>-type. |
protected void |
doInitialize()
This method performs the actual
initialization . |
ReflectionUtil |
getReflectionUtil()
This method gets the
ReflectionUtilImpl instance to use. |
void |
setReflectionUtil(ReflectionUtil reflectionUtil) |
createLogger, getLogger
doInitialized, getInitializationState, initialize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convert, getSourceType, getTargetType
private ReflectionUtil reflectionUtil
public ReflectionUtil getReflectionUtil()
ReflectionUtilImpl
instance to use.ReflectionUtilImpl
to use.@Inject public void setReflectionUtil(ReflectionUtil reflectionUtil)
reflectionUtil
- is the reflectionUtil to setprotected void doInitialize()
AbstractComponent
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractLoggableComponent
public final <T extends TARGET> T convert(SOURCE value, Object valueSource, Class<T> targetClass)
ValueConverter
pojo
to the <TARGET>-type.convert
in interface SimpleValueConverter<SOURCE,TARGET>
convert
in interface ValueConverter<SOURCE,TARGET>
T
- is the generic type of targetClass
.value
- is the value to convert.valueSource
- describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.targetClass
- is the type to convert the value
to.value
or null
if the conversion is NOT possible. The returned value
has to be an instance
of the given targetType
.ValueConverter.convert(Object, Object, GenericType)
Copyright © 2001–2016 mmm-Team. All rights reserved.