Skip to content
Snippets Groups Projects

Refactor all DTO conversions

15 files
+ 170
239
Compare changes
  • Side-by-side
  • Inline

Files

@@ -32,19 +32,22 @@ public abstract class Create<D> extends Validated {
*
* @return The created entity.
*/
public D apply(ModelMapper mapper) {
public D apply() {
validateOrThrow();
ModelMapper mapper = createMapper();
configureMapper(mapper);
D data = mapper.map(this, clazz());
postApply(data);
return data;
}
/**
* Configures the {@link ModelMapper} that will be used by the Create application.
*
* @return The {@link ModelMapper} created for mapping the Create DTO.
* Configures the {@link ModelMapper} that will be used by the Create DTO.
*/
protected ModelMapper createMapper() {
return new ModelMapper();
protected void configureMapper(ModelMapper mapper) {
// Leave empty
}
/**
Loading