T - the tuple type for this assembler.Dto - the actual dto type.public abstract class BaseTupleAssembler<T extends org.javatuples.Tuple,Dto> extends AbstractBaseAssembler<T,Dto>
dtoClass| Constructor and Description |
|---|
BaseTupleAssembler()
Default needed constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Dto |
assembleDtoFromAggregate(T sourceAggregate)
This method is used by developers or by
Assemblers to assemble a new DTO from the given aggregate. |
protected abstract void |
doAssembleDtoFromAggregate(Dto targetDto,
T sourceAggregate)
This method has to be overridden by users to actually assembling the DTO from the aggregate.
|
protected abstract void |
doMergeAggregateWithDto(T targetAggregate,
Dto sourceDto)
This method has to be overridden by users to actually merge an aggregate with the DTO.
|
void |
mergeAggregateWithDto(T targetAggregate,
Dto sourceDto)
This method is used by developers or by
Assemblers to actually merge the aggregate. |
void |
updateDtoFromAggregate(Dto sourceDto,
T sourceAggregate)
Updates the given DTO from the aggregate.
|
getDtoClass, newDtopublic BaseTupleAssembler()
TupleType aggregateClasses.public Dto assembleDtoFromAggregate(T sourceAggregate)
Assemblers to assemble a new DTO from the given aggregate.
AbstractBaseAssembler.newDto() for the DTO creation;
doAssembleDtoFromAggregate(Object, org.javatuples.Tuple) for the assembly algorithm.
sourceAggregate - The aggregate from which create the DTO.Assembler.assembleDtoFromAggregate(Object)public void updateDtoFromAggregate(Dto sourceDto, T sourceAggregate)
AssemblersourceDto - The dto to update.sourceAggregate - The aggregate to copy data from.public void mergeAggregateWithDto(T targetAggregate, Dto sourceDto)
Assemblers to actually merge the aggregate.
It will call doMergeAggregateWithDto(org.javatuples.Tuple, Object), which is overridden by developers.
targetAggregate - the aggregate to mergesourceDto - the dto to copy data fromAssembler.mergeAggregateWithDto(Object, Object)protected abstract void doAssembleDtoFromAggregate(Dto targetDto, T sourceAggregate)
targetDto.fillProductId(sourceAggregate.getEntityId().getStoreId(),
sourceAggregate.getEntityId().getProductCode());
targetDto.setName(sourceAggregate.getName());
targetDto.setDescription(sourceAggregate.getDescription());
This method will be called by the public method assembleDtoFromAggregate(org.javatuples.Tuple)targetDto - the dto to assemblesourceAggregate - the aggregate to copy data fromprotected abstract void doMergeAggregateWithDto(T targetAggregate, Dto sourceDto)
... targetAggregate.setName(sourceDto.getName()); targetAggregate.setDescription(sourceDto.getDescription()); ...This method will be called by the public method
mergeAggregateWithDto(org.javatuples.Tuple, Object)targetAggregate - the aggregate to mergesourceDto - the dto to copy data fromCopyright © 2013-2015–2015. All rights reserved.