mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 11:05:56 +01:00
Config Resource DTO Mappers: Make use of BaseMapper.
More DRY.
This commit is contained in:
@@ -3,7 +3,6 @@ package sonia.scm.api.v2.resources;
|
||||
import de.otto.edison.hal.Links;
|
||||
import org.mapstruct.AfterMapping;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import sonia.scm.config.ConfigurationPermissions;
|
||||
import sonia.scm.repository.SvnConfig;
|
||||
@@ -16,14 +15,11 @@ import static de.otto.edison.hal.Links.linkingTo;
|
||||
// Mapstruct does not support parameterized (i.e. non-default) constructors. Thus, we need to use field injection.
|
||||
@SuppressWarnings("squid:S3306")
|
||||
@Mapper
|
||||
public abstract class SvnConfigToSvnConfigDtoMapper {
|
||||
public abstract class SvnConfigToSvnConfigDtoMapper extends BaseMapper<SvnConfig, SvnConfigDto> {
|
||||
|
||||
@Inject
|
||||
private UriInfoStore uriInfoStore;
|
||||
|
||||
@Mapping(target = "attributes", ignore = true) // We do not map HAL attributes
|
||||
public abstract SvnConfigDto map(SvnConfig config);
|
||||
|
||||
@AfterMapping
|
||||
void appendLinks(SvnConfig config, @MappingTarget SvnConfigDto target) {
|
||||
Links.Builder linksBuilder = linkingTo().self(self());
|
||||
|
||||
Reference in New Issue
Block a user