@SuppressWarnings("unchecked") public Collection<ResourceIdentifier> toResourceIdentifiers() { return ((Collection<Resource>) get()).stream() .map(object -> object != null ? object.toResourceIdentifier() : null) .collect(Collectors.toList()); } }
@SuppressWarnings("unchecked") public Collection<ResourceIdentifier> toResourceIdentifiers() { return ((Collection<Resource>) get()).stream() .map(object -> object != null ? object.toResourceIdentifier() : null) .collect(Collectors.toList()); } }
public Relationship(@JsonProperty("links") Map<String, String> links, @JsonProperty("data") Data<Resource> data) { this.links = links; this.data = data; if (data != null) { if (data.isToOne()) { Resource resource = data.getSingleValue(); this.idData = new Data<>(resource != null ? resource.toResourceIdentifier() : null); } else { this.idData = new Data<>( data.get().stream() .map(Resource::toResourceIdentifier) .collect(Collectors.toList()) ); } } else { this.idData = null; } }
public Relationship(@JsonProperty("links") Map<String, String> links, @JsonProperty("data") Data<Resource> data) { this.links = links; this.data = data; if (data != null) { if (data.isToOne()) { Resource resource = data.getSingleValue(); this.idData = new Data<>(resource != null ? resource.toResourceIdentifier() : null); } else { this.idData = new Data<>( data.get().stream() .map(Resource::toResourceIdentifier) .collect(Collectors.toList()) ); } } else { this.idData = null; } }