Class DocumentPropertyJsonWriter
java.lang.Object
org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter<Property>
org.nuxeo.ecm.core.io.marshallers.json.document.DocumentPropertyJsonWriter
- All Implemented Interfaces:
Marshaller<Property>
,Writer<Property>
@Setup(mode=SINGLETON,
priority=2000)
public class DocumentPropertyJsonWriter
extends AbstractJsonWriter<Property>
Convert
Property
to Json.
Format is:
"stringPropertyValue" <-- for string property, each property may be fetched if a resolver is associated with that property and if a parameter fetch.document=propXPath is present, in this case, an object will be marshalled as value or true|false <- for boolean property or 123 <- for int property ... { <- for complex property "subProperty": ..., ... }, [ ... ] <- for list property }
- Since:
- 7.2
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Whether we should omit to write phantom secured properties.Fields inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
ctx, registry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
enrichBlobProperty
(com.fasterxml.jackson.core.JsonGenerator jg, BlobProperty property) protected boolean
fetchProperty
(com.fasterxml.jackson.core.JsonGenerator jg, ObjectResolver resolver, Object value, String path) protected String
getBlobUrl
(Property prop) Gets the full URL of where a blob can be downloaded.protected String
getBlobUrl
(Property prop, boolean fullDownloadUrl) protected static boolean
skipProperty
(RenderingContext ctx, Property property) void
Implement this method to writes the entity in the providedJsonGenerator
.protected void
writeBlobProperty
(com.fasterxml.jackson.core.JsonGenerator jg, BlobProperty prop) protected void
writeComplexProperty
(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) protected void
writeListProperty
(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) protected void
writeProperty
(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) protected void
writeScalarProperty
(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) protected void
writeScalarPropertyValue
(com.fasterxml.jackson.core.JsonGenerator jg, Type type, Object value) Methods inherited from class org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonWriter
accept, getGenerator, write, writeEntity, writeEntity, writeEntityField, writeSerializable, writeSerializableField, writeSerializableListField, writeSerializableMapField
-
Field Details
-
OMIT_PHANTOM_SECURED_PROPERTY
Whether we should omit to write phantom secured properties.- Since:
- 11.1
- See Also:
-
-
Constructor Details
-
DocumentPropertyJsonWriter
public DocumentPropertyJsonWriter()
-
-
Method Details
-
write
Description copied from class:AbstractJsonWriter
Implement this method to writes the entity in the providedJsonGenerator
.This method implementation can use injected properties.
The
JsonGenerator
's flushing is done by this abstract class, it's also not not necessary to flush it. Do not close the providedJsonGenerator
. It may be used is another marshaller calling this one.- Specified by:
write
in classAbstractJsonWriter<Property>
- Parameters:
prop
- The entity to marshall as Json.jg
- TheJsonGenerator
used to produce Json output.- Throws:
IOException
-
writeProperty
protected void writeProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException - Throws:
IOException
-
writeScalarProperty
protected void writeScalarProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException - Throws:
IOException
-
writeScalarPropertyValue
protected void writeScalarPropertyValue(com.fasterxml.jackson.core.JsonGenerator jg, Type type, Object value) throws IOException - Throws:
IOException
-
fetchProperty
protected boolean fetchProperty(com.fasterxml.jackson.core.JsonGenerator jg, ObjectResolver resolver, Object value, String path) throws IOException - Throws:
IOException
-
writeListProperty
protected void writeListProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException - Throws:
IOException
-
writeComplexProperty
protected void writeComplexProperty(com.fasterxml.jackson.core.JsonGenerator jg, Property prop) throws IOException - Throws:
IOException
-
writeBlobProperty
protected void writeBlobProperty(com.fasterxml.jackson.core.JsonGenerator jg, BlobProperty prop) throws IOException - Throws:
IOException
-
enrichBlobProperty
protected void enrichBlobProperty(com.fasterxml.jackson.core.JsonGenerator jg, BlobProperty property) throws IOException - Throws:
IOException
- Since:
- 10.3
-
getBlobUrl
Gets the full URL of where a blob can be downloaded.- Since:
- 7.2
-
getBlobUrl
- Since:
- 2021.43
-
skipProperty
-