mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
Add method to embed collections
This commit is contained in:
@@ -2,6 +2,8 @@ package sonia.scm.api.v2.resources;
|
||||
|
||||
import de.otto.edison.hal.HalRepresentation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The {@link HalAppender} can be used within an {@link HalEnricher} to append hateoas links to a json response.
|
||||
*
|
||||
@@ -34,6 +36,14 @@ public interface HalAppender {
|
||||
*/
|
||||
void appendEmbedded(String rel, HalRepresentation embeddedItem);
|
||||
|
||||
/**
|
||||
* Appends a list of embedded objects to the json response.
|
||||
*
|
||||
* @param rel name of relation
|
||||
* @param embeddedItems embedded objects
|
||||
*/
|
||||
void appendEmbedded(String rel, List<HalRepresentation> embeddedItems);
|
||||
|
||||
/**
|
||||
* Builder for link arrays.
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,11 @@ class EdisonHalAppender implements HalAppender {
|
||||
embeddedBuilder.with(rel, embedded);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendEmbedded(String rel, List<HalRepresentation> embedded) {
|
||||
embeddedBuilder.with(rel, embedded);
|
||||
}
|
||||
|
||||
private static class EdisonLinkArrayBuilder implements LinkArrayBuilder {
|
||||
|
||||
private final Links.Builder builder;
|
||||
|
||||
Reference in New Issue
Block a user