Class SimpleStructGenerator
java.lang.Object
com.fasterxml.jackson.core.JsonGenerator
org.assertstruct.impl.converter.jackson.SimpleStructGenerator
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned,Closeable,Flushable,AutoCloseable
public class SimpleStructGenerator
extends com.fasterxml.jackson.core.JsonGenerator
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.core.JsonGenerator
com.fasterxml.jackson.core.JsonGenerator.Feature -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intOffset within last segment,protected booleanprotected booleanFlag set during construction, if use ofBigDecimalis to be forced on all floating-point values.protected intBit flag composed of bits that indicate whichJsonGenerator.Features are enabled.protected booleanDo we currently have a native type or object id buffered?protected booleanprotected booleanprotected booleanprotected com.fasterxml.jackson.core.ObjectCodecObject codec to use for stream-based object conversion through parser/generator interfaces.protected ObjectIf native object ids supported, this is the id for following value (or first token of one) to be written.protected com.fasterxml.jackson.core.JsonStreamContextParse context from "parent" parser (one from which content to buffer is read, if specified).protected com.fasterxml.jackson.core.StreamReadConstraintsprotected ObjectIf native type ids supported, this is the id for following value (or first token of one) to be written.protected com.fasterxml.jackson.core.json.JsonWriteContextprotected static final intFields inherited from class com.fasterxml.jackson.core.JsonGenerator
_cfgPrettyPrinter, DEFAULT_BINARY_WRITE_CAPABILITIES, DEFAULT_TEXTUAL_WRITE_CAPABILITIES, DEFAULT_WRITE_CAPABILITIES -
Constructor Summary
ConstructorsConstructorDescriptionSimpleStructGenerator(com.fasterxml.jackson.core.ObjectCodec codec, boolean hasNativeIds) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void_appendEndMarker(com.fasterxml.jackson.core.JsonToken type) Specialized method used for appending a structural end Object/Array markerprotected final void_appendFieldName(Object value) Specialized method used for appending a field name, appending eitherStringorSerializableString.protected final void_appendStartMarker(com.fasterxml.jackson.core.JsonToken type) Specialized method used for appending a structural start Object/Array markerprotected final void_appendValue(com.fasterxml.jackson.core.JsonToken type) Method used for appending token known to represent a "simple" scalar value where token is the only informationprotected final void_appendValue(com.fasterxml.jackson.core.JsonToken type, Object value) Method used for appending token known to represent a scalar value where there is additional content (text, number) beyond type tokenprotected void_copyBufferContents(com.fasterxml.jackson.core.JsonParser p) protected voidvoidbooleanSince we can efficiently storebyte[], yes.booleanbooleanvoidclose()voidcopyCurrentEvent(com.fasterxml.jackson.core.JsonParser p) voidcopyCurrentStructure(com.fasterxml.jackson.core.JsonParser p) com.fasterxml.jackson.core.JsonGeneratordisable(com.fasterxml.jackson.core.JsonGenerator.Feature f) com.fasterxml.jackson.core.JsonGeneratorenable(com.fasterxml.jackson.core.JsonGenerator.Feature f) voidflush()forceUseOfBigDecimal(boolean b) com.fasterxml.jackson.core.ObjectCodecgetCodec()intfinal com.fasterxml.jackson.core.json.JsonWriteContextcom.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamWriteCapability> booleanisClosed()booleanisEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f) com.fasterxml.jackson.core.JsonGeneratoroverrideStdFeatures(int values, int mask) com.fasterxml.jackson.core.JsonGeneratorsetCodec(com.fasterxml.jackson.core.ObjectCodec oc) com.fasterxml.jackson.core.JsonGeneratorsetFeatureMask(int mask) Deprecated.voidcom.fasterxml.jackson.core.JsonGeneratorcom.fasterxml.jackson.core.Versionversion()voidwriteBinary(com.fasterxml.jackson.core.Base64Variant b64variant, byte[] data, int offset, int len) intwriteBinary(com.fasterxml.jackson.core.Base64Variant b64variant, InputStream data, int dataLength) Although we could support this method, it does not necessarily make sense: we cannot make good use of streaming because buffer must hold all the data.voidwriteBoolean(boolean state) voidwriteEmbeddedObject(Object object) final voidfinal voidvoidwriteFieldName(com.fasterxml.jackson.core.SerializableString name) final voidwriteFieldName(String name) voidvoidwriteNumber(double d) voidwriteNumber(float f) voidwriteNumber(int i) voidwriteNumber(long l) voidwriteNumber(short i) voidwriteNumber(String encodedValue) voidwriteNumber(BigDecimal dec) voidvoidwriteObject(Object value) voidwriteObjectId(Object id) voidwriteRaw(char c) voidwriteRaw(char[] text, int offset, int len) voidwriteRaw(com.fasterxml.jackson.core.SerializableString text) voidvoidvoidwriteRawUTF8String(byte[] text, int offset, int length) voidwriteRawValue(char[] text, int offset, int len) voidwriteRawValue(String text) voidwriteRawValue(String text, int offset, int len) final voidvoidwriteStartArray(Object forValue) voidwriteStartArray(Object forValue, int size) final voidvoidwriteStartObject(Object forValue) voidwriteStartObject(Object forValue, int size) voidwriteString(char[] text, int offset, int len) voidwriteString(com.fasterxml.jackson.core.SerializableString text) voidwriteString(Reader reader, int len) voidwriteString(String text) voidwriteTree(com.fasterxml.jackson.core.TreeNode node) voidwriteTypeId(Object id) voidwriteUTF8String(byte[] text, int offset, int length) Methods inherited from class com.fasterxml.jackson.core.JsonGenerator
_constructWriteException, _constructWriteException, _constructWriteException, _constructWriteException, _copyCurrentContents, _copyCurrentFloatValue, _copyCurrentFloatValueExact, _copyCurrentIntValue, _copyCurrentStringValue, _reportError, _reportUnsupportedOperation, _throwInternal, _verifyOffsets, _writeSimpleObject, canOmitFields, canUseSchema, canWriteFormattedNumbers, configure, copyCurrentEventExact, currentValue, getCharacterEscapes, getCurrentValue, getFormatFeatures, getHighestEscapedChar, getOutputBuffered, getOutputTarget, getPrettyPrinter, getSchema, isEnabled, overrideFormatFeatures, setCharacterEscapes, setCurrentValue, setHighestNonEscapedChar, setPrettyPrinter, setRootValueSeparator, setSchema, streamWriteConstraints, writeArray, writeArray, writeArray, writeArray, writeArrayFieldStart, writeBinary, writeBinary, writeBinary, writeBinaryField, writeBooleanField, writeFieldId, writeNullField, writeNumber, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeNumberField, writeObjectField, writeObjectFieldStart, writeObjectRef, writeOmittedField, writePOJO, writePOJOField, writeRawValue, writeStartArray, writeStringField, writeTypePrefix, writeTypeSuffix
-
Field Details
-
DEFAULT_GENERATOR_FEATURES
protected static final int DEFAULT_GENERATOR_FEATURES -
_objectCodec
protected com.fasterxml.jackson.core.ObjectCodec _objectCodecObject codec to use for stream-based object conversion through parser/generator interfaces. If null, such methods cannot be used. -
_parentContext
protected com.fasterxml.jackson.core.JsonStreamContext _parentContextParse context from "parent" parser (one from which content to buffer is read, if specified). Used, if available, when reading content, to present full context as if content was read from the original parser: this is useful in error reporting and sometimes processing as well. -
_generatorFeatures
protected int _generatorFeaturesBit flag composed of bits that indicate whichJsonGenerator.Features are enabled.NOTE: most features have no effect on this class
-
_streamReadConstraints
protected com.fasterxml.jackson.core.StreamReadConstraints _streamReadConstraints- Since:
- 2.15
-
_closed
protected boolean _closed -
_hasNativeTypeIds
protected boolean _hasNativeTypeIds- Since:
- 2.3
-
_hasNativeObjectIds
protected boolean _hasNativeObjectIds- Since:
- 2.3
-
_mayHaveNativeIds
protected boolean _mayHaveNativeIds- Since:
- 2.3
-
_forceBigDecimal
protected boolean _forceBigDecimalFlag set during construction, if use ofBigDecimalis to be forced on all floating-point values. -
_appendAt
protected int _appendAtOffset within last segment, -
_typeId
If native type ids supported, this is the id for following value (or first token of one) to be written. -
_objectId
If native object ids supported, this is the id for following value (or first token of one) to be written. -
_hasNativeId
protected boolean _hasNativeIdDo we currently have a native type or object id buffered? -
_writeContext
protected com.fasterxml.jackson.core.json.JsonWriteContext _writeContext
-
-
Constructor Details
-
SimpleStructGenerator
public SimpleStructGenerator(com.fasterxml.jackson.core.ObjectCodec codec, boolean hasNativeIds) - Parameters:
codec- Object codec to use for stream-based object conversion through parser/generator interfaces. If null, such methods cannot be used.hasNativeIds- Whether resultingJsonParser(if created) is considered to support native type and object ids
-
-
Method Details
-
getRootObject
-
forceUseOfBigDecimal
-
version
public com.fasterxml.jackson.core.Version version()- Specified by:
versionin interfacecom.fasterxml.jackson.core.Versioned- Specified by:
versionin classcom.fasterxml.jackson.core.JsonGenerator
-
enable
public com.fasterxml.jackson.core.JsonGenerator enable(com.fasterxml.jackson.core.JsonGenerator.Feature f) - Specified by:
enablein classcom.fasterxml.jackson.core.JsonGenerator
-
disable
public com.fasterxml.jackson.core.JsonGenerator disable(com.fasterxml.jackson.core.JsonGenerator.Feature f) - Specified by:
disablein classcom.fasterxml.jackson.core.JsonGenerator
-
isEnabled
public boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f) - Specified by:
isEnabledin classcom.fasterxml.jackson.core.JsonGenerator
-
getFeatureMask
public int getFeatureMask()- Specified by:
getFeatureMaskin classcom.fasterxml.jackson.core.JsonGenerator
-
setFeatureMask
Deprecated.- Specified by:
setFeatureMaskin classcom.fasterxml.jackson.core.JsonGenerator
-
overrideStdFeatures
public com.fasterxml.jackson.core.JsonGenerator overrideStdFeatures(int values, int mask) - Overrides:
overrideStdFeaturesin classcom.fasterxml.jackson.core.JsonGenerator
-
useDefaultPrettyPrinter
public com.fasterxml.jackson.core.JsonGenerator useDefaultPrettyPrinter()- Specified by:
useDefaultPrettyPrinterin classcom.fasterxml.jackson.core.JsonGenerator
-
setCodec
public com.fasterxml.jackson.core.JsonGenerator setCodec(com.fasterxml.jackson.core.ObjectCodec oc) - Specified by:
setCodecin classcom.fasterxml.jackson.core.JsonGenerator
-
getCodec
public com.fasterxml.jackson.core.ObjectCodec getCodec()- Specified by:
getCodecin classcom.fasterxml.jackson.core.JsonGenerator
-
getOutputContext
public final com.fasterxml.jackson.core.json.JsonWriteContext getOutputContext()- Specified by:
getOutputContextin classcom.fasterxml.jackson.core.JsonGenerator
-
canWriteBinaryNatively
public boolean canWriteBinaryNatively()Since we can efficiently storebyte[], yes.- Overrides:
canWriteBinaryNativelyin classcom.fasterxml.jackson.core.JsonGenerator
-
getWriteCapabilities
public com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamWriteCapability> getWriteCapabilities()- Overrides:
getWriteCapabilitiesin classcom.fasterxml.jackson.core.JsonGenerator
-
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
isClosed
public boolean isClosed()- Specified by:
isClosedin classcom.fasterxml.jackson.core.JsonGenerator
-
writeStartArray
- Specified by:
writeStartArrayin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeStartArray
- Overrides:
writeStartArrayin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeStartArray
- Overrides:
writeStartArrayin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeEndArray
- Specified by:
writeEndArrayin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeStartObject
- Specified by:
writeStartObjectin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeStartObject
- Overrides:
writeStartObjectin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeStartObject
- Overrides:
writeStartObjectin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeEndObject
- Specified by:
writeEndObjectin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeFieldName
- Specified by:
writeFieldNamein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeFieldName
- Specified by:
writeFieldNamein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeString
- Specified by:
writeStringin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeString
- Specified by:
writeStringin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeString
- Specified by:
writeStringin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeString
- Overrides:
writeStringin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRawUTF8String
- Specified by:
writeRawUTF8Stringin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeUTF8String
- Specified by:
writeUTF8Stringin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRaw
- Specified by:
writeRawin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRaw
- Specified by:
writeRawin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRaw
- Overrides:
writeRawin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRaw
- Specified by:
writeRawin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRaw
- Specified by:
writeRawin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRawValue
- Specified by:
writeRawValuein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRawValue
- Specified by:
writeRawValuein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeRawValue
- Specified by:
writeRawValuein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Overrides:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNumber
- Specified by:
writeNumberin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeNull
- Specified by:
writeNullin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeObject
- Specified by:
writeObjectin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeTree
- Specified by:
writeTreein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeBinary
public void writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant, byte[] data, int offset, int len) throws IOException - Specified by:
writeBinaryin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
writeBinary
public int writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant, InputStream data, int dataLength) Although we could support this method, it does not necessarily make sense: we cannot make good use of streaming because buffer must hold all the data. Because of this, currently this will simply throwUnsupportedOperationException- Specified by:
writeBinaryin classcom.fasterxml.jackson.core.JsonGenerator
-
canWriteTypeId
public boolean canWriteTypeId()- Overrides:
canWriteTypeIdin classcom.fasterxml.jackson.core.JsonGenerator
-
canWriteObjectId
public boolean canWriteObjectId()- Overrides:
canWriteObjectIdin classcom.fasterxml.jackson.core.JsonGenerator
-
writeTypeId
- Overrides:
writeTypeIdin classcom.fasterxml.jackson.core.JsonGenerator
-
writeObjectId
- Overrides:
writeObjectIdin classcom.fasterxml.jackson.core.JsonGenerator
-
writeEmbeddedObject
- Overrides:
writeEmbeddedObjectin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
copyCurrentEvent
- Overrides:
copyCurrentEventin classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
copyCurrentStructure
- Overrides:
copyCurrentStructurein classcom.fasterxml.jackson.core.JsonGenerator- Throws:
IOException
-
_copyBufferContents
- Throws:
IOException
-
_appendValue
protected final void _appendValue(com.fasterxml.jackson.core.JsonToken type) Method used for appending token known to represent a "simple" scalar value where token is the only information -
_appendValue
Method used for appending token known to represent a scalar value where there is additional content (text, number) beyond type token -
_appendFieldName
-
_appendStartMarker
protected final void _appendStartMarker(com.fasterxml.jackson.core.JsonToken type) Specialized method used for appending a structural start Object/Array marker -
_appendEndMarker
protected final void _appendEndMarker(com.fasterxml.jackson.core.JsonToken type) Specialized method used for appending a structural end Object/Array marker -
_reportUnsupportedOperation
protected void _reportUnsupportedOperation()- Overrides:
_reportUnsupportedOperationin classcom.fasterxml.jackson.core.JsonGenerator
-
skipNextValue
public void skipNextValue() -
assignCurrentValue
- Overrides:
assignCurrentValuein classcom.fasterxml.jackson.core.JsonGenerator
-