public class ODataJsonSerializer extends Object implements ODataSerializer
DEFAULT_CHARSET| Constructor and Description |
|---|
ODataJsonSerializer(ContentType contentType) |
ODataJsonSerializer(ContentType contentType,
IConstants constants) |
| Modifier and Type | Method and Description |
|---|---|
protected ContextURL |
checkContextURL(ContextURL contextURL) |
SerializerResult |
complex(ServiceMetadata metadata,
EdmComplexType type,
Property property,
ComplexSerializerOptions options)
Writes complex-type instance data into an InputStream.
|
SerializerResult |
complexCollection(ServiceMetadata metadata,
EdmComplexType type,
Property property,
ComplexSerializerOptions options)
Writes data of a collection of complex-type instances into an InputStream.
|
SerializerResult |
entity(ServiceMetadata metadata,
EdmEntityType entityType,
Entity entity,
EntitySerializerOptions options)
Writes entity data into an InputStream.
|
SerializerResult |
entityCollection(ServiceMetadata metadata,
EdmEntityType entityType,
AbstractEntityCollection entitySet,
EntityCollectionSerializerOptions options)
Writes entity-collection data into an InputStream.
|
void |
entityCollectionIntoStream(ServiceMetadata metadata,
EdmEntityType entityType,
AbstractEntityCollectionObject entitySet,
EntityCollectionSerializerOptions options,
OutputStream outputStream) |
SerializerStreamResult |
entityCollectionStreamed(ServiceMetadata metadata,
EdmEntityType entityType,
AbstractEntityCollectionObject entities,
EntityCollectionSerializerOptions options)
Writes entity-collection data into an InputStream.
|
SerializerResult |
error(ODataServerError error)
Writes an ODataError into an InputStream.
|
protected String |
getEntityId(Entity entity,
EdmEntityType entityType,
String name)
Get the ascii representation of the entity id
or thrown an
SerializerException if id is null. |
SerializerResult |
metadataDocument(ServiceMetadata serviceMetadata)
Writes the metadata document into an InputStream.
|
SerializerResult |
primitive(ServiceMetadata metadata,
EdmPrimitiveType type,
Property property,
PrimitiveSerializerOptions options)
Writes primitive-type instance data into an InputStream.
|
SerializerResult |
primitiveCollection(ServiceMetadata metadata,
EdmPrimitiveType type,
Property property,
PrimitiveSerializerOptions options)
Writes data of a collection of primitive-type instances into an InputStream.
|
SerializerResult |
reference(ServiceMetadata metadata,
EdmEntitySet edmEntitySet,
Entity entity,
ReferenceSerializerOptions options)
Writes a single entity reference into an InputStream.
|
SerializerResult |
referenceCollection(ServiceMetadata metadata,
EdmEntitySet edmEntitySet,
AbstractEntityCollection entityCollection,
ReferenceCollectionSerializerOptions options)
Writes entity-collection references into an InputStream.
|
protected EdmComplexType |
resolveComplexType(ServiceMetadata metadata,
EdmComplexType baseType,
String derivedTypeName) |
protected EdmEntityType |
resolveEntityType(ServiceMetadata metadata,
EdmEntityType baseType,
String derivedTypeName) |
SerializerResult |
serviceDocument(ServiceMetadata metadata,
String serviceRoot)
Writes the service document into an InputStream.
|
protected void |
writeComplexValue(ServiceMetadata metadata,
EdmComplexType type,
List<Property> properties,
Set<List<String>> selectedPaths,
com.fasterxml.jackson.core.JsonGenerator json,
Set<List<String>> expandedPaths,
Linked linked,
ExpandOption expand,
String complexPropName) |
protected void |
writeContextURL(ContextURL contextURL,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeEntity(ServiceMetadata metadata,
EdmEntityType entityType,
Entity entity,
ContextURL contextURL,
ExpandOption expand,
Integer toDepth,
SelectOption select,
boolean onlyReference,
Set<String> ancestors,
String name,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeEntitySet(ServiceMetadata metadata,
EdmEntityType entityType,
AbstractEntityCollectionObject entitySet,
ExpandOption expand,
Integer toDepth,
SelectOption select,
boolean onlyReference,
Set<String> ancestors,
String name,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeExpandedNavigationProperty(ServiceMetadata metadata,
EdmNavigationProperty property,
Link navigationLink,
ExpandOption innerExpand,
Integer toDepth,
SelectOption innerSelect,
CountOption innerCount,
boolean writeOnlyCount,
boolean writeOnlyRef,
Set<String> ancestors,
String name,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeExpandedStreamProperties(ServiceMetadata metadata,
EdmStructuredType type,
Linked linked,
ExpandOption expand,
Integer toDepth,
Set<String> ancestors,
String name,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeGeoValue(String name,
EdmPrimitiveType type,
Geospatial geoValue,
Boolean isNullable,
com.fasterxml.jackson.core.JsonGenerator json,
SRID parentSrid)
Writes a geospatial value following the GeoJSON specification defined in RFC 7946.
|
protected void |
writeInlineCount(String propertyName,
Integer count,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeMetadataETag(ServiceMetadata metadata,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeNavigationProperties(ServiceMetadata metadata,
EdmStructuredType type,
Linked linked,
ExpandOption expand,
Integer toDepth,
Set<String> ancestors,
String name,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeNextLink(AbstractEntityCollectionObject entitySet,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writePrimitiveValue(String name,
EdmPrimitiveType type,
Object primitiveValue,
Boolean isNullable,
Integer maxLength,
Integer precision,
Integer scale,
Boolean isUnicode,
com.fasterxml.jackson.core.JsonGenerator json) |
protected void |
writeProperties(ServiceMetadata metadata,
EdmStructuredType type,
List<Property> properties,
SelectOption select,
com.fasterxml.jackson.core.JsonGenerator json,
Linked linked,
ExpandOption expand) |
protected void |
writeProperty(ServiceMetadata metadata,
EdmProperty edmProperty,
Property property,
Set<List<String>> selectedPaths,
com.fasterxml.jackson.core.JsonGenerator json,
Set<List<String>> expandedPaths,
Linked linked,
ExpandOption expand) |
public ODataJsonSerializer(ContentType contentType)
public ODataJsonSerializer(ContentType contentType, IConstants constants)
public SerializerResult serviceDocument(ServiceMetadata metadata, String serviceRoot) throws SerializerException
ODataSerializerserviceDocument in interface ODataSerializermetadata - the metadata information for the serviceserviceRoot - the service-root URI of this OData serviceSerializerExceptionpublic SerializerResult metadataDocument(ServiceMetadata serviceMetadata) throws SerializerException
ODataSerializermetadataDocument in interface ODataSerializerserviceMetadata - the metadata information for the serviceSerializerExceptionpublic SerializerResult error(ODataServerError error) throws SerializerException
ODataSerializererror in interface ODataSerializererror - the main errorSerializerExceptionpublic SerializerResult entityCollection(ServiceMetadata metadata, EdmEntityType entityType, AbstractEntityCollection entitySet, EntityCollectionSerializerOptions options) throws SerializerException
ODataSerializerentityCollection in interface ODataSerializermetadata - metadata for the serviceentityType - the EdmEntityTypeentitySet - the data of the entity setoptions - options for the serializerSerializerExceptionpublic SerializerStreamResult entityCollectionStreamed(ServiceMetadata metadata, EdmEntityType entityType, AbstractEntityCollectionObject entities, EntityCollectionSerializerOptions options) throws SerializerException
ODataSerializerentityCollectionStreamed in interface ODataSerializermetadata - metadata for the serviceentityType - the EdmEntityTypeentities - the data of the entity setoptions - options for the serializerSerializerExceptionpublic void entityCollectionIntoStream(ServiceMetadata metadata, EdmEntityType entityType, AbstractEntityCollectionObject entitySet, EntityCollectionSerializerOptions options, OutputStream outputStream) throws SerializerException
SerializerExceptionpublic SerializerResult entity(ServiceMetadata metadata, EdmEntityType entityType, Entity entity, EntitySerializerOptions options) throws SerializerException
ODataSerializerentity in interface ODataSerializermetadata - metadata for the serviceentityType - the EdmEntityTypeentity - the data of the entityoptions - options for the serializerSerializerExceptionprotected ContextURL checkContextURL(ContextURL contextURL) throws SerializerException
SerializerExceptionprotected void writeEntitySet(ServiceMetadata metadata, EdmEntityType entityType, AbstractEntityCollectionObject entitySet, ExpandOption expand, Integer toDepth, SelectOption select, boolean onlyReference, Set<String> ancestors, String name, com.fasterxml.jackson.core.JsonGenerator json) throws IOException, SerializerException, org.apache.commons.codec.DecoderException
IOExceptionSerializerExceptionorg.apache.commons.codec.DecoderExceptionprotected String getEntityId(Entity entity, EdmEntityType entityType, String name) throws SerializerException
SerializerException if id is null.entity - the entityentityType - name - SerializerExceptionprotected void writeEntity(ServiceMetadata metadata, EdmEntityType entityType, Entity entity, ContextURL contextURL, ExpandOption expand, Integer toDepth, SelectOption select, boolean onlyReference, Set<String> ancestors, String name, com.fasterxml.jackson.core.JsonGenerator json) throws IOException, SerializerException, org.apache.commons.codec.DecoderException
IOExceptionSerializerExceptionorg.apache.commons.codec.DecoderExceptionprotected EdmEntityType resolveEntityType(ServiceMetadata metadata, EdmEntityType baseType, String derivedTypeName) throws SerializerException
SerializerExceptionprotected EdmComplexType resolveComplexType(ServiceMetadata metadata, EdmComplexType baseType, String derivedTypeName) throws SerializerException
SerializerExceptionprotected void writeProperties(ServiceMetadata metadata, EdmStructuredType type, List<Property> properties, SelectOption select, com.fasterxml.jackson.core.JsonGenerator json, Linked linked, ExpandOption expand) throws IOException, SerializerException, org.apache.commons.codec.DecoderException
IOExceptionSerializerExceptionorg.apache.commons.codec.DecoderExceptionprotected void writeNavigationProperties(ServiceMetadata metadata, EdmStructuredType type, Linked linked, ExpandOption expand, Integer toDepth, Set<String> ancestors, String name, com.fasterxml.jackson.core.JsonGenerator json) throws SerializerException, IOException, org.apache.commons.codec.DecoderException
SerializerExceptionIOExceptionorg.apache.commons.codec.DecoderExceptionprotected void writeExpandedStreamProperties(ServiceMetadata metadata, EdmStructuredType type, Linked linked, ExpandOption expand, Integer toDepth, Set<String> ancestors, String name, com.fasterxml.jackson.core.JsonGenerator json) throws SerializerException, IOException, org.apache.commons.codec.DecoderException
SerializerExceptionIOExceptionorg.apache.commons.codec.DecoderExceptionprotected void writeExpandedNavigationProperty(ServiceMetadata metadata, EdmNavigationProperty property, Link navigationLink, ExpandOption innerExpand, Integer toDepth, SelectOption innerSelect, CountOption innerCount, boolean writeOnlyCount, boolean writeOnlyRef, Set<String> ancestors, String name, com.fasterxml.jackson.core.JsonGenerator json) throws IOException, SerializerException, org.apache.commons.codec.DecoderException
IOExceptionSerializerExceptionorg.apache.commons.codec.DecoderExceptionprotected void writeProperty(ServiceMetadata metadata, EdmProperty edmProperty, Property property, Set<List<String>> selectedPaths, com.fasterxml.jackson.core.JsonGenerator json, Set<List<String>> expandedPaths, Linked linked, ExpandOption expand) throws IOException, SerializerException, org.apache.commons.codec.DecoderException
IOExceptionSerializerExceptionorg.apache.commons.codec.DecoderExceptionprotected void writePrimitiveValue(String name, EdmPrimitiveType type, Object primitiveValue, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, com.fasterxml.jackson.core.JsonGenerator json) throws EdmPrimitiveTypeException, IOException
EdmPrimitiveTypeExceptionIOExceptionprotected void writeGeoValue(String name, EdmPrimitiveType type, Geospatial geoValue, Boolean isNullable, com.fasterxml.jackson.core.JsonGenerator json, SRID parentSrid) throws EdmPrimitiveTypeException, IOException, SerializerException
protected void writeComplexValue(ServiceMetadata metadata, EdmComplexType type, List<Property> properties, Set<List<String>> selectedPaths, com.fasterxml.jackson.core.JsonGenerator json, Set<List<String>> expandedPaths, Linked linked, ExpandOption expand, String complexPropName) throws IOException, SerializerException, org.apache.commons.codec.DecoderException
IOExceptionSerializerExceptionorg.apache.commons.codec.DecoderExceptionpublic SerializerResult primitive(ServiceMetadata metadata, EdmPrimitiveType type, Property property, PrimitiveSerializerOptions options) throws SerializerException
ODataSerializerprimitive in interface ODataSerializermetadata - metadata for the servicetype - primitive typeproperty - property valueoptions - options for the serializerSerializerExceptionpublic SerializerResult complex(ServiceMetadata metadata, EdmComplexType type, Property property, ComplexSerializerOptions options) throws SerializerException
ODataSerializercomplex in interface ODataSerializermetadata - metadata for the servicetype - complex typeproperty - property valueoptions - options for the serializerSerializerExceptionpublic SerializerResult primitiveCollection(ServiceMetadata metadata, EdmPrimitiveType type, Property property, PrimitiveSerializerOptions options) throws SerializerException
ODataSerializerprimitiveCollection in interface ODataSerializermetadata - metadata for the servicetype - primitive typeproperty - property valueoptions - options for the serializerSerializerExceptionpublic SerializerResult complexCollection(ServiceMetadata metadata, EdmComplexType type, Property property, ComplexSerializerOptions options) throws SerializerException
ODataSerializercomplexCollection in interface ODataSerializermetadata - metadata for the servicetype - complex typeproperty - property valueoptions - options for the serializerSerializerExceptionpublic SerializerResult reference(ServiceMetadata metadata, EdmEntitySet edmEntitySet, Entity entity, ReferenceSerializerOptions options) throws SerializerException
ODataSerializerreference in interface ODataSerializermetadata - metadata for the serviceedmEntitySet - EdmEntitySetentity - data of the entityoptions - ReferenceSerializerOptionsSerializerExceptionpublic SerializerResult referenceCollection(ServiceMetadata metadata, EdmEntitySet edmEntitySet, AbstractEntityCollection entityCollection, ReferenceCollectionSerializerOptions options) throws SerializerException
ODataSerializerreferenceCollection in interface ODataSerializermetadata - metadata for the serviceedmEntitySet - EdmEntitySetentityCollection - data of the entity collectionoptions - ReferenceCollectionSerializerOptionsSerializerExceptionprotected void writeContextURL(ContextURL contextURL, com.fasterxml.jackson.core.JsonGenerator json) throws IOException
IOExceptionprotected void writeMetadataETag(ServiceMetadata metadata, com.fasterxml.jackson.core.JsonGenerator json) throws IOException
IOExceptionprotected void writeInlineCount(String propertyName, Integer count, com.fasterxml.jackson.core.JsonGenerator json) throws IOException
IOExceptionprotected void writeNextLink(AbstractEntityCollectionObject entitySet, com.fasterxml.jackson.core.JsonGenerator json) throws IOException
IOExceptionCopyright © 2023. All rights reserved.