#1132 - HAL link relation rendering now applies Jackson's PropertyNamingStrategy.

The rendering of HAL's link relations now applies Jackson's PropertyNamingStrategy if one is configured except it's a IANA link relation. This behavior can be opt out from by setting HalConfiguration.withApplyPropertyNamingStrategy(false).

LinkRelation now has a ….map(…) method allowing the post-processing of it given a Function<String, String>. By default, that's applied to all relations that are not IANA ones. HalLinkRelation applies this transformation to only the local part of the relation. Tweaked IanaLinkRelations.isIanaLinkRelation(…) to do a simple ….contains(…) check first before we stream over all values to apply a case insensitive check.
This commit is contained in:
Oliver Drotbohm
2019-12-06 12:05:02 +01:00
parent 8f1f355c9f
commit a2290c692a
12 changed files with 249 additions and 55 deletions

View File

@@ -786,8 +786,8 @@ public class IanaLinkRelations {
Assert.notNull(relation, "Link relation must not be null!");
return LINK_RELATIONS.stream() //
.anyMatch(it -> it.value().equalsIgnoreCase(relation.value()));
return LINK_RELATIONS.contains(relation) //
|| LINK_RELATIONS.stream().anyMatch(it -> it.isSameAs(relation));
}