diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/CollectionToDtoMapper.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/CollectionToDtoMapper.java deleted file mode 100644 index 4f8c6a6f3f..0000000000 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/CollectionToDtoMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package sonia.scm.api.v2.resources; - -import de.otto.edison.hal.HalRepresentation; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import static de.otto.edison.hal.Embedded.embeddedBuilder; -import static de.otto.edison.hal.Links.linkingTo; - -abstract class CollectionToDtoMapper { - - private final String collectionName; - private final BaseMapper mapper; - - protected CollectionToDtoMapper(String collectionName, BaseMapper mapper) { - this.collectionName = collectionName; - this.mapper = mapper; - } - - public HalRepresentation map(Collection collection) { - List dtos = collection.stream().map(mapper::map).collect(Collectors.toList()); - return new HalRepresentation( - linkingTo().self(createSelfLink()).build(), - embeddedBuilder().with(collectionName, dtos).build() - ); - } - - protected abstract String createSelfLink(); - -}