public Annotations mergeWithParent(Annotations parentAnnotations) { boolean ignoredButMappedByParent = parentAnnotations.containsKey(JsonProperty.class) && containsKey(JsonIgnore.class); boolean mappedButIgnoredByParent = parentAnnotations.containsKey(JsonIgnore.class) && containsKey(JsonProperty.class); Annotations annotations = MapUtil.merge( this, parentAnnotations, annotation -> annotation, (annotation, annotationParent) -> annotation); if (ignoredButMappedByParent) { annotations.remove(JsonProperty.class); } if (mappedButIgnoredByParent) { annotations.remove(JsonIgnore.class); } return annotations; }
public Annotations mergeWith(Annotations map) { return MapUtil.merge( this, map, annotation -> annotation, (annotation, annotationParent) -> annotation); }