public class JSONPropertyWriter extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
JSONPropertyWriter.PropertyConsumer |
Modifier and Type | Field and Description |
---|---|
protected DateTimeFormat |
dateTimeFormat
The date time format.
|
protected String |
filesBaseUrl
The baseUrl that can be used to locate blob content.
|
protected String |
prefix
The prefix to append to field name.
|
protected boolean |
writeEmpty
Whether or not this writer write empty list or object.
|
protected boolean |
writeNull
Whether or not this writer write null values.
|
Modifier | Constructor and Description |
---|---|
protected |
JSONPropertyWriter()
Instantiate a JSONPropertyWriter.
|
protected |
JSONPropertyWriter(JSONPropertyWriter writer)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
static JSONPropertyWriter |
create() |
JSONPropertyWriter |
dateTimeFormat(DateTimeFormat dateTimeFormat) |
JSONPropertyWriter |
filesBaseUrl(String filesBaseUrl) |
JSONPropertyWriter |
prefix(String prefix) |
protected void |
writeBlobProperty(org.codehaus.jackson.JsonGenerator jg,
Property prop,
JSONPropertyWriter.PropertyConsumer fieldNameWriter) |
JSONPropertyWriter |
writeEmpty(boolean writeEmpty) |
protected void |
writeListProperty(org.codehaus.jackson.JsonGenerator jg,
Property prop,
JSONPropertyWriter.PropertyConsumer fieldNameWriter) |
protected void |
writeMapProperty(org.codehaus.jackson.JsonGenerator jg,
ComplexProperty prop,
JSONPropertyWriter.PropertyConsumer fieldNameWriter) |
JSONPropertyWriter |
writeNull(boolean writeNull) |
void |
writeProperty(org.codehaus.jackson.JsonGenerator jg,
Property prop)
Converts the value of the given core property to JSON.
|
protected void |
writeProperty(org.codehaus.jackson.JsonGenerator jg,
Property prop,
JSONPropertyWriter.PropertyConsumer fieldNameWriter)
Converts the value of the given core property to JSON.
|
static void |
writePropertyValue(org.codehaus.jackson.JsonGenerator jg,
Property prop,
DateTimeFormat dateTimeFormat,
String filesBaseUrl)
Converts the value of the given core property to JSON.
|
protected void |
writeScalarProperty(org.codehaus.jackson.JsonGenerator jg,
Property prop,
JSONPropertyWriter.PropertyConsumer fieldNameWriter) |
protected DateTimeFormat dateTimeFormat
protected String filesBaseUrl
protected boolean writeNull
protected boolean writeEmpty
protected JSONPropertyWriter()
protected JSONPropertyWriter(JSONPropertyWriter writer)
public static JSONPropertyWriter create()
JSONPropertyWriter
instance with DateTimeFormat.W3C
as date time formatter.public JSONPropertyWriter dateTimeFormat(DateTimeFormat dateTimeFormat)
JSONPropertyWriter
filled with the previous configuration and the input dateTimeFormat.public JSONPropertyWriter filesBaseUrl(String filesBaseUrl)
filesBaseUrl
- the baseUrl that can be used to locate blob contentJSONPropertyWriter
filled with the previous configuration and the input filesBaseUrl.public JSONPropertyWriter prefix(String prefix)
prefix
- the prefix to append for each propertyJSONPropertyWriter
filled with the previous configuration and the input prefix.public JSONPropertyWriter writeNull(boolean writeNull)
writeNull
- whether or not this writer might write null valuesJSONPropertyWriter
filled with the previous configuration and the input writeNull value.public JSONPropertyWriter writeEmpty(boolean writeEmpty)
writeEmpty
- whether or not this writer might write empty array/list/objectJSONPropertyWriter
filled with the previous configuration and the input writeEmpty value.public void writeProperty(org.codehaus.jackson.JsonGenerator jg, Property prop) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
JsonGenerator
with its prefix without writing the start
and the end of object.PropertyException
org.codehaus.jackson.JsonGenerationException
IOException
protected void writeProperty(org.codehaus.jackson.JsonGenerator jg, Property prop, JSONPropertyWriter.PropertyConsumer fieldNameWriter) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
fieldNameWriter
- the field name writer is used to write the field name depending on writer configuration,
this parameter also allows us to handle different cases: field with prefix, field under complex
property, or nothing for arrays and listsPropertyException
org.codehaus.jackson.JsonGenerationException
IOException
protected void writeScalarProperty(org.codehaus.jackson.JsonGenerator jg, Property prop, JSONPropertyWriter.PropertyConsumer fieldNameWriter) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
PropertyException
org.codehaus.jackson.JsonGenerationException
IOException
protected void writeListProperty(org.codehaus.jackson.JsonGenerator jg, Property prop, JSONPropertyWriter.PropertyConsumer fieldNameWriter) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
PropertyException
org.codehaus.jackson.JsonGenerationException
IOException
protected void writeMapProperty(org.codehaus.jackson.JsonGenerator jg, ComplexProperty prop, JSONPropertyWriter.PropertyConsumer fieldNameWriter) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
PropertyException
org.codehaus.jackson.JsonGenerationException
IOException
protected void writeBlobProperty(org.codehaus.jackson.JsonGenerator jg, Property prop, JSONPropertyWriter.PropertyConsumer fieldNameWriter) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
PropertyException
org.codehaus.jackson.JsonGenerationException
IOException
public static void writePropertyValue(org.codehaus.jackson.JsonGenerator jg, Property prop, DateTimeFormat dateTimeFormat, String filesBaseUrl) throws PropertyException, org.codehaus.jackson.JsonGenerationException, IOException
PropertyException
org.codehaus.jackson.JsonGenerationException
IOException
Copyright © 2017 Nuxeo. All rights reserved.