public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
checkArgument(checkNotNull(input, "input") instanceof SingleResourceTransportDto[],
"this binder is only valid for SingleResourceTransportDto arrays");
SingleResourceTransportDto[] dtos = (SingleResourceTransportDto[]) input;
LinksDto refs = new LinksDto();
for (SingleResourceTransportDto dto : dtos) {
RESTLink editLink = checkNotNull(dto.getEditLink(), "entity must have an edit link");
// Do not add repeated references
if (refs.searchLinkByHref(editLink.getHref()) == null) {
refs.addLink(new RESTLink(getRelToUse(input), editLink.getHref()));
}
}
return super.bindToRequest(request, refs);
}