DATAREST-1446 - DefaultExcerptProjector now declines presence of projection if metadata returns Optional.empty().

If no excerpt projection is exposed by the underlying ResourceMetadata, DefaultExcerptProjector now also properly declines its existence in ….hasExcerptProjection(…). Previously, it always indicated a presence as it improperly used a null check rather than calling Optional.isPresent().

Original pull request: #366.
This commit is contained in:
Javier Grande Pérez
2019-10-28 14:44:11 +01:00
committed by Oliver Drotbohm
parent b016c0b125
commit 694079df04

View File

@@ -64,6 +64,6 @@ public class DefaultExcerptProjector implements ExcerptProjector {
public boolean hasExcerptProjection(Class<?> type) {
ResourceMetadata metadata = mappings.getMetadataFor(type);
return metadata == null ? false : metadata.getExcerptProjection() != null;
return metadata == null ? false : metadata.getExcerptProjection().isPresent();
}
}