public class DefaultJsonGenerator
Temporary fork of DefaultJsonGenerator until Groovy 2.5.0 is out.
A JsonGenerator that can be configured with various JsonGenerator.Options.
If the default options are sufficient consider using the static JsonOutput.toJson
methods.
Modifiers | Name | Description |
---|---|---|
protected static class |
DefaultJsonGenerator.ClosureConverter |
A converter that handles converting a given type to a JSON value using a closure. |
Modifiers | Name | Description |
---|---|---|
protected java.util.Set<Converter> |
converters |
|
protected java.lang.String |
dateFormat |
|
protected java.util.Locale |
dateLocale |
|
protected boolean |
disableUnicodeEscaping |
|
protected boolean |
excludeNulls |
|
protected java.util.Set<java.lang.String> |
excludedFieldNames |
|
protected java.util.Set<java.lang.Class<?>> |
excludedFieldTypes |
|
protected java.util.TimeZone |
timezone |
Constructor and description |
---|
protected DefaultJsonGenerator
(Options options) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected Converter |
findConverter(java.lang.Class<?> type) Finds a converter that can handle the given type. |
|
protected java.util.Map<?, ?> |
getObjectProperties(java.lang.Object object) |
|
public boolean |
isExcludingFieldsNamed(java.lang.String name) {@inheritDoc} |
|
public boolean |
isExcludingValues(java.lang.Object value) {@inheritDoc} |
|
protected boolean |
shouldExcludeType(java.lang.Class<?> type) Indicates whether the given type should be excluded from the generated output. |
|
public java.lang.String |
toJson(java.lang.Object object) {@inheritDoc} |
|
protected void |
writeArray(java.lang.Class<?> arrayClass, java.lang.Object array, org.apache.groovy.json.internal.CharBuf buffer) Serializes array and writes it into specified buffer. |
|
protected void |
writeCharSequence(java.lang.CharSequence seq, org.apache.groovy.json.internal.CharBuf buffer) Serializes any char sequence and writes it into specified buffer. |
|
protected void |
writeDate(java.util.Date date, org.apache.groovy.json.internal.CharBuf buffer) Serializes date and writes it into specified buffer. |
|
protected void |
writeIterator(java.util.Iterator<?> iterator, org.apache.groovy.json.internal.CharBuf buffer) Serializes iterator and writes it into specified buffer. |
|
protected void |
writeMap(java.util.Map<?, ?> map, org.apache.groovy.json.internal.CharBuf buffer) Serializes map and writes it into specified buffer. |
|
protected void |
writeMapEntry(java.lang.String key, java.lang.Object value, org.apache.groovy.json.internal.CharBuf buffer) Serializes a map entry and writes it into specified buffer. |
|
protected void |
writeNumber(java.lang.Class<?> numberClass, java.lang.Number value, org.apache.groovy.json.internal.CharBuf buffer) Serializes Number value and writes it into specified buffer. |
|
protected void |
writeObject(java.lang.Object object, org.apache.groovy.json.internal.CharBuf buffer) |
|
protected void |
writeObject(java.lang.String key, java.lang.Object object, org.apache.groovy.json.internal.CharBuf buffer) Serializes object and writes it into specified buffer. |
|
protected void |
writeRaw(java.lang.CharSequence seq, org.apache.groovy.json.internal.CharBuf buffer) Serializes any char sequence and writes it into specified buffer without performing any manipulation of the given text. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Finds a converter that can handle the given type. The first converter
that reports it can handle the type is returned, based on the order in
which the converters were specified. A null
value will be returned
if no suitable converter can be found for the given type.
type
- that this converter can handlenull
if no compatible converters are found for the given type.{@inheritDoc}
{@inheritDoc}
Indicates whether the given type should be excluded from the generated output.
type
- the type to checktrue
if the given type should not be output, else false
{@inheritDoc}
Serializes array and writes it into specified buffer.
arrayClass
- the Array classarray
- an array to serialize into JSONbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes any char sequence and writes it into specified buffer.
seq
- a java.lang.CharSequence to serialize and encodebuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes date and writes it into specified buffer.
date
- A java.util.Date to serialize into JSON stringbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes iterator and writes it into specified buffer.
iterator
- a java.util.Iterator to serialize to JSON stringbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes map and writes it into specified buffer.
map
- a java.util.Map to serialize to JSON stringbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes a map entry and writes it into specified buffer.
key
- a Map.Entry keyvalue
- a Map.Entry valuebuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes Number value and writes it into specified buffer.
numberClass
- The object java.lang.Classvalue
- a java.lang.Numberbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes object and writes it into specified buffer.
key
- the name for the valueobject
- to convert to JSONbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized valueSerializes any char sequence and writes it into specified buffer without performing any manipulation of the given text.
seq
- a java.lang.CharSequence to serialize to stringbuffer
- a org.apache.groovy.json.internal.CharBuf buffer to write the serialized value