#678 - Add 'profile' to Link.
Fully support HAL spec by adding "profile" as another optional attribute to `Link`. See: https://tools.ietf.org/html/draft-kelly-json-hal-08, https://tools.ietf.org/html/rfc5988
This commit is contained in:
@@ -68,6 +68,7 @@ public class Link implements Serializable {
|
||||
private @Wither String title;
|
||||
private @Wither String type;
|
||||
private @Wither String deprecation;
|
||||
private @Wither String profile;
|
||||
private @JsonIgnore UriTemplate template;
|
||||
private @JsonIgnore List<Affordance> affordances;
|
||||
|
||||
@@ -183,7 +184,7 @@ public class Link implements Serializable {
|
||||
public Link withAffordances(List<Affordance> affordances) {
|
||||
|
||||
return new Link(this.rel, this.href, this.hreflang, this.media, this.title, this.type, this.deprecation,
|
||||
this.template, affordances);
|
||||
this.profile, this.template, affordances);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,6 +299,10 @@ public class Link implements Serializable {
|
||||
linkString += ";deprecation=\"" + deprecation + "\"";
|
||||
}
|
||||
|
||||
if (profile != null) {
|
||||
linkString += ";profile=\"" + profile + "\"";
|
||||
}
|
||||
|
||||
return linkString;
|
||||
}
|
||||
|
||||
@@ -349,6 +354,10 @@ public class Link implements Serializable {
|
||||
link = link.withDeprecation(attributes.get("deprecation"));
|
||||
}
|
||||
|
||||
if (attributes.containsKey("profile")) {
|
||||
link = link.withProfile(attributes.get("profile"));
|
||||
}
|
||||
|
||||
return link;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user