public static Link of(String href) {
return new Link(href);
}
public static Link of(String href, String relation) {
return new Link(href, relation);
}
public static Link of(String href, LinkRelation relation) {
return new Link(href, relation);
}
public static Link of(UriTemplate template, String relation) {
return new Link(template, relation);
}
public static Link of(UriTemplate template, LinkRelation relation) {
return new Link(template, relation);
}
Link link = Link.of("/{segment}/something{?parameter}");
Map<String, Object> values = new HashMap<>();
values.put("segment", "path");
values.put("parameter", 42);
assertThat(link.expand(values).getHref())
.isEqualTo("/path/something?parameter=42");
Link link = Link.of("/some-resource"), IanaLinkRelations.NEXT);
assertThat(link.getRel()).isEqualTo(LinkRelation.of("next"));
assertThat(IanaLinkRelation.isIanaRel(link.getRel())).isTrue();
public class BookModel extends RepresentationModel<BookModel> {
private final Book content;
}