T - the tuple type for this assembler.D - the actual dto type.public abstract class BaseTupleAssembler<T extends org.javatuples.Tuple,D> extends AbstractBaseAssembler<T,D>
dtoClass| Constructor and Description |
|---|
BaseTupleAssembler() |
| Modifier and Type | Method and Description |
|---|---|
void |
assembleDtoFromAggregate(D targetDto,
T sourceAggregate)
Updates an existing DTO with a source aggregate root.
|
D |
assembleDtoFromAggregate(T sourceAggregate)
This method is used by developers or by
FluentAssembler
to assemble a new DTO from the given aggregate. |
protected abstract void |
doAssembleDtoFromAggregate(D 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,
D sourceDto)
This method has to be overridden by users to actually merge an aggregate with the DTO.
|
void |
mergeAggregateWithDto(T targetAggregate,
D sourceDto)
This method is used by developers or by
FluentAssembler
to actually merge the aggregate. |
getDtoClass, newDtopublic D assembleDtoFromAggregate(T sourceAggregate)
FluentAssembler
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 assembleDtoFromAggregate(D targetDto, T sourceAggregate)
AssemblertargetDto - The target dtosourceAggregate - The source aggregatepublic void mergeAggregateWithDto(T targetAggregate, D sourceDto)
FluentAssembler
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(D 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, D 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-2016–2016 SeedStack. All rights reserved.