A
- the type of the aggregate root.D
- the type of the DTO.public abstract class ModelMapperAssembler<A extends AggregateRoot<?>,D> extends BaseAssembler<A,D>
ModelMapper
instance.Modifier | Constructor and Description |
---|---|
|
ModelMapperAssembler() |
protected |
ModelMapperAssembler(Class<D> dtoClass) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
configure(org.modelmapper.ModelMapper modelMapper)
This method is called once when the first mapping of the assembler occurs.
|
D |
createDtoFromAggregate(A sourceAggregate)
Creates a new DTO and merge the given aggregate into it.
|
void |
mergeAggregateIntoDto(A sourceAggregate,
D targetDto)
Merge a source aggregate into an existing target DTO.
|
void |
mergeDtoIntoAggregate(D sourceDto,
A targetAggregate)
Merges a source DTO into an existing target aggregate root.
|
createDto, getDtoClass
public D createDtoFromAggregate(A sourceAggregate)
Assembler
Assembler.createDto()
is called
to create the DTO instance, then Assembler.mergeAggregateIntoDto(Object, Object)
is called to do
the merge.sourceAggregate
- the source aggregate.public void mergeAggregateIntoDto(A sourceAggregate, D targetDto)
Assembler
sourceAggregate
- the source aggregate.targetDto
- the target dto.public void mergeDtoIntoAggregate(D sourceDto, A targetAggregate)
Assembler
sourceDto
- the source dto.targetAggregate
- the target aggregate.protected abstract void configure(org.modelmapper.ModelMapper modelMapper)
ModelMapper
instance that will be used for mapping. This instance will then be reused for subsequent
calls.modelMapper
- the ModelMapper
instance to configure.Copyright © 2013-2018–2019 SeedStack. All rights reserved.