@ComponentSpecification public interface TransferObjectUtil extends TransferObjectUtilLimited
AbstractTransferObjects.TransferObjectUtilImpl.getInstance()| Modifier and Type | Method and Description |
|---|---|
<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> |
convertFromEntity(ENTITY entity,
Class<TO> toType)
This method converts the given
PersistenceEntity to the corresponding transfer-object
identified by the given Class. |
<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> |
convertFromEntityList(List<ENTITY> entityList,
Class<TO> toType)
Variant of
convertFromEntity(PersistenceEntity, Class) for a List. |
<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> |
convertFromEntitySet(Set<ENTITY> entitySet,
Class<TO> toType)
Variant of
convertFromEntity(PersistenceEntity, Class) for a Set. |
<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> |
convertToEntity(TO transferObject,
Class<ENTITY> entityType)
This method converts the given
ETO to the corresponding PersistenceEntity identified by
the given Class. |
<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> |
convertToEntityList(List<TO> transferObjects,
Class<ENTITY> entityType)
Variant of
convertToEntity(EntityTo, Class) for a List. |
<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> |
convertToEntitySet(Set<TO> transferObjects,
Class<ENTITY> entityType)
Variant of
convertToEntity(EntityTo, Class) for a Set. |
void |
updateModificationCounter(Object container,
boolean remove)
This method recursively updates all
modification counters of the
ETOs contained in the given container. |
clone, newInstance<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> TO convertFromEntity(ENTITY entity, Class<TO> toType)
PersistenceEntity to the corresponding transfer-object
identified by the given Class.ID - is the generic type of the ID.ENTITY - is the generic type of the entity to convert.TO - is the generic type of the transfer-object to create.entity - is the PersistenceEntity to convert.toType - is the Class reflecting the ETO to create.toType with the values of the given entity.<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> List<TO> convertFromEntityList(List<ENTITY> entityList, Class<TO> toType)
convertFromEntity(PersistenceEntity, Class) for a List.ID - is the generic type of the ID.ENTITY - is the generic type of the entity to convert.TO - is the generic type of the transfer-object to create.entityList - is the List of entities to convert.toType - is the Class reflecting the ETO to create.List with all entities from entityList
converted to the given toType.<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> Set<TO> convertFromEntitySet(Set<ENTITY> entitySet, Class<TO> toType)
convertFromEntity(PersistenceEntity, Class) for a Set.ID - is the generic type of the ID.ENTITY - is the generic type of the entity to convert.TO - is the generic type of the transfer-object to create.entitySet - is the Set of entities to convert.toType - is the Class reflecting the ETO to create.Set with all entities from entitySet
converted to the given toType.<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> ENTITY convertToEntity(TO transferObject, Class<ENTITY> entityType)
ETO to the corresponding PersistenceEntity identified by
the given Class.ID - is the generic type of the ID.ENTITY - is the generic type of the entity to create.TO - is the generic type of the ETO to convert.transferObject - is the ETO to convert.entityType - is the Class reflecting the PersistenceEntity to create.entityType with the values of the given transferObject.<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> List<ENTITY> convertToEntityList(List<TO> transferObjects, Class<ENTITY> entityType)
convertToEntity(EntityTo, Class) for a List.ID - is the generic type of the ID.ENTITY - is the generic type of the entity to create.TO - is the generic type of the ETO to convert.transferObjects - is the List of ETOs to convert.entityType - is the Class reflecting the PersistenceEntity to create.List with all ETOs from transferObjects
converted to the given entityType.<ID,ENTITY extends PersistenceEntity<ID>,TO extends EntityTo<ID>> Set<ENTITY> convertToEntitySet(Set<TO> transferObjects, Class<ENTITY> entityType)
convertToEntity(EntityTo, Class) for a Set.ID - is the generic type of the ID.ENTITY - is the generic type of the entity to create.TO - is the generic type of the ETO to convert.transferObjects - is the Set of ETOs to convert.entityType - is the Class reflecting the PersistenceEntity to create.Set with all ETOs from transferObjects
converted to the given entityType.void updateModificationCounter(Object container, boolean remove)
modification counters of the
ETOs contained in the given container. convertFromEntity(PersistenceEntity, Class) is typically used before the transaction has been
closed (by the logic layer of the application). However, JPA implementations like hibernate only update the
modification counter after the transaction has been closed and
the new modification counters are available from the DB. EntityTo and this method offer the perfect
solution to this problem. All you have to do is call this method once for the transfer object you want to send to
the client after the transaction has been committed and before the object gets serialized. TransferObjectUtil. Otherwise this can lead to an infinity loop. However, having cycles in
TransferObjects is typically a design flaw. If you think different you can try to convince us so we will
add support for this.container - is the EntityTo to update or any other TransferObject, bean,
Collection, or Map potentially containing an EntityTo.remove - - true to remove any internal references from ETOs so they get dereferences
and garbage-collected, false otherwise.EntityTo.getModificationCounter()Copyright © 2001–2016 mmm-Team. All rights reserved.