@Singleton @Named public class ValueConverterEntityToEto extends AbstractValueConverterToSimilarPojo<PersistenceEntity,EntityTo>
AbstractValueConverterToCompatiblePojo
for conversion from PersistenceEntity
to
ETO
. See EntityTo.getModificationCounter()
for further details.Modifier and Type | Class and Description |
---|---|
private static class |
ValueConverterEntityToEto.EtoHelper
Make
EntityTo.PersistentEntityAccess accessible. |
Modifier and Type | Field and Description |
---|---|
private static ValueConverterEntityToEto.EtoHelper |
HELPER
The singleton instance of
ValueConverterEntityToEto.EtoHelper . |
Constructor and Description |
---|
ValueConverterEntityToEto()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
<T extends EntityTo> |
convert(PersistenceEntity value,
Object valueSource,
GenericType<T> targetType)
This method converts the given
pojo to the <TARGET>-type. |
Class<PersistenceEntity> |
getSourceType()
This the type of the value accepted by this converter.
|
Class<EntityTo> |
getTargetType()
Is the guaranteed return-type of the
conversion . |
handleNoGetterForSetter
doInitialize, getPojoDescriptorBuilder, getPojoDescriptorBuilderFactory, setPojoDescriptorBuilder, setPojoDescriptorBuilderFactory, setPojoFactory
getComposedValueConverter, setComposedValueConverter
convert, getReflectionUtil, setReflectionUtil
createLogger, getLogger
doInitialized, getInitializationState, initialize
private static final ValueConverterEntityToEto.EtoHelper HELPER
ValueConverterEntityToEto.EtoHelper
.public Class<PersistenceEntity> getSourceType()
ValueConverter
Object
if you want to accept any
value. A very common source-type
is String
.public Class<EntityTo> getTargetType()
ValueConverter
conversion
. This
information is used externally to choose the most specific ValueConverter
that is
appropriate
for the conversion. Object
as target-type
while a specific
converter may have Collection
as target-type
. Now if an object
(compliant with the source-type
) needs to be converted to a
Collection
or List
, the specific converter is used while for other
objects the generic converter is chosen. target-type
is often more general than the actual
returned result
. So a ValueConverter
that converts
a comma-separated String
to an ArrayList
will typically declare
List
as target-type
.public <T extends EntityTo> T convert(PersistenceEntity value, Object valueSource, GenericType<T> targetType) throws ValueException
ValueConverter
pojo
to the <TARGET>-type.convert
in interface ValueConverter<PersistenceEntity,EntityTo>
convert
in class AbstractValueConverterToCompatiblePojo<PersistenceEntity,EntityTo>
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.targetType
- is the GenericType
to convert the value
to. It is potentially generic
and therefore contains more detailed information than a Class
. E.g. the targetType
could be java.util.List<Long>
. This could help e.g. if the value
is a
string like "2, 47, 4252525"
.value
or null
if the conversion is NOT possible. The returned value
has to be an instance
of the given targetType
.ValueException
- if the conversion failed (e.g. the given value
is illegal for the given
targetClass
).Copyright © 2001–2016 mmm-Team. All rights reserved.