} else if (serilizerOptions.isAssignableFrom(EntityCollectionSerializerOptions.class)) { return (T) EntityCollectionSerializerOptions.with() .contextURL(contextUrl) .count(uriInfo.getCountOption()).expand(uriInfo.getExpandOption()) .select(uriInfo.getSelectOption()).writeOnlyReferences(references)
} else if (serilizerOptions.isAssignableFrom(EntityCollectionSerializerOptions.class)) { return (T) EntityCollectionSerializerOptions.with() .contextURL(contextUrl) .count(uriInfo.getCountOption()).expand(uriInfo.getExpandOption()) .select(uriInfo.getSelectOption()).writeOnlyReferences(references)
@Override public SerializerResult serialize(final ODataRequest request, final EntityCollection result) throws SerializerException { final EdmEntitySet targetEdmEntitySet = Util.determineTargetEntitySet(uriInfo.getUriResourceParts()); final String selectList = uriHelper.buildContextURLSelectList(targetEdmEntitySet.getEntityType(), uriInfo.getExpandOption(), uriInfo.getSelectOption()); final ContextURL contextUrl = ContextURL.with() .entitySet(targetEdmEntitySet) .selectList(selectList) .build(); final String id = request.getRawBaseUri() + "/" + targetEdmEntitySet.getEntityType().getName(); final EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with() .contextURL(contextUrl) .id(id) .count(uriInfo.getCountOption()) .select(uriInfo.getSelectOption()) .expand(uriInfo.getExpandOption()) .build(); return serializer.entityCollection(this.serviceMetadata, targetEdmEntitySet.getEntityType(), result, opts); }
@Override public SerializerResult serialize(final Annotatable annotatable, final EdmType entityType) throws SerializerException, ODataJPASerializerException { final EntityCollection result = (EntityCollection) annotatable; final String selectList = uriHelper.buildContextURLSelectList((EdmEntityType) entityType, uriInfo.getExpandOption(), uriInfo.getSelectOption()); final ContextURL contextUrl = ContextURL.with() .asCollection() .type(entityType) .selectList(selectList) .build(); final EntityCollectionSerializerOptions options = EntityCollectionSerializerOptions.with() .contextURL(contextUrl) .select(uriInfo.getSelectOption()) .expand(uriInfo.getExpandOption()) .build(); return serializer.entityCollection(serviceMetadata, (EdmEntityType) entityType, result, options); }