Top Description Inners Methods
tools.jackson.core

public Interface ObjectWriteContext

Known Direct Implementers
tools.jackson.core.ObjectWriteContext.Base
Imports
java.io.OutputStream, .Writer, tools.jackson.core.exc.JacksonIOException, .StreamWriteException, tools.jackson.core.io.CharacterEscapes, tools.jackson.core.tree.ArrayTreeNode, .ObjectTreeNode

Defines API for accessing configuration and state exposed by higher level databind functionality during write (Object to token stream serialization) process. Access is mostly needed during construction of JsonGenerator instances by TokenStreamFactory.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ObjectWriteContext.Base

Default no-op implementation.

Method Summary

Modifier and TypeMethod and Description
public ArrayTreeNode

Returns:

Array node created
createArrayNode
()

Method for construct Array nodes for Tree Model instances.

public default JsonGenerator
public default JsonGenerator
public default JsonGenerator
public ObjectTreeNode

Returns:

Object node created
createObjectNode
()

Method for construct Object nodes for Tree Model instances.

public static ObjectWriteContext
public CharacterEscapes
public int
getFormatWriteFeatures(int defaults)

public PrettyPrinter

Returns:

PrettyPrinter instance to use for a single serialization operation
getPrettyPrinter
()

Accessor for getting PrettyPrinter instance to use for a new generator.

public SerializableString
public FormatSchema
public int
getStreamWriteFeatures(int defaults)

public boolean

Returns:

True if getPrettyPrinter() would return non-null; false otherwise.
hasPrettyPrinter
()

Accessor similar to getPrettyPrinter() but which only indicates whether a non-null instance would be constructed if requested, or not.

public TokenStreamFactory
public void
public void
writeValue(JsonGenerator
Generator to use for serialization
g
,
Object
Java value to be serialized
value
)

Method that may be called to serialize given value, using specified token stream generator.

Method Detail

createArrayNodeback to summary
public ArrayTreeNode createArrayNode()

Method for construct Array nodes for Tree Model instances.

Returns:ArrayTreeNode

Array node created

createGeneratorback to summary
public default JsonGenerator createGenerator(OutputStream out) throws JacksonException
createGeneratorback to summary
public default JsonGenerator createGenerator(OutputStream out, JsonEncoding enc) throws JacksonException
createGeneratorback to summary
public default JsonGenerator createGenerator(Writer w) throws JacksonException
createObjectNodeback to summary
public ObjectTreeNode createObjectNode()

Method for construct Object nodes for Tree Model instances.

Returns:ObjectTreeNode

Object node created

emptyback to summary
public static ObjectWriteContext empty()
getCharacterEscapesback to summary
public CharacterEscapes getCharacterEscapes()
getFormatWriteFeaturesback to summary
public int getFormatWriteFeatures(int defaults)
getPrettyPrinterback to summary
public PrettyPrinter getPrettyPrinter()

Accessor for getting PrettyPrinter instance to use for a new generator. Note that this MUST BE a thread-safe instance: that is, if the pretty printer implementation is stateful, a new unshared instance needs to be returned -- caller will NOT try to make a copy of tools.jackson.core.util.Instantiatable printers, context must do that.

Returns:PrettyPrinter

PrettyPrinter instance to use for a single serialization operation

getRootValueSeparatorback to summary
public SerializableString getRootValueSeparator(SerializableString defaultSeparator)
getSchemaback to summary
public FormatSchema getSchema()
getStreamWriteFeaturesback to summary
public int getStreamWriteFeatures(int defaults)
hasPrettyPrinterback to summary
public boolean hasPrettyPrinter()

Accessor similar to getPrettyPrinter() but which only indicates whether a non-null instance would be constructed if requested, or not. This is useful for backends that have custom pretty-printing instead of relying on Jackson standard mechanism.

Returns:boolean

True if getPrettyPrinter() would return non-null; false otherwise.

tokenStreamFactoryback to summary
public TokenStreamFactory tokenStreamFactory()
writeTreeback to summary
public void writeTree(JsonGenerator g, TreeNode value) throws JacksonException
writeValueback to summary
public void writeValue(JsonGenerator g, Object value) throws JacksonException

Method that may be called to serialize given value, using specified token stream generator.

Parameters
g:JsonGenerator

Generator to use for serialization

value:Object

Java value to be serialized

Exceptions
JacksonException:
(various subtypes) for databinding problems
JacksonIOException:
for low-level write problems,
StreamWriteException:
for encoding problems
tools.jackson.core back to summary

public Class ObjectWriteContext.Base

extends Object
implements ObjectWriteContext
Class Inheritance
All Implemented Interfaces
tools.jackson.core.ObjectWriteContext

Default no-op implementation.

Field Summary

Modifier and TypeField and Description
protected static ObjectWriteContext.Base

Constructor Summary

AccessConstructor and Description
public
Base()

Method Summary

Modifier and TypeMethod and Description
protected <T> T
public ArrayTreeNode
createArrayNode()

Implements tools.jackson.core.ObjectWriteContext.createArrayNode.

Method for construct Array nodes for Tree Model instances.

public ObjectTreeNode
createObjectNode()

Implements tools.jackson.core.ObjectWriteContext.createObjectNode.

Method for construct Object nodes for Tree Model instances.

public CharacterEscapes
public int
public PrettyPrinter
getPrettyPrinter()

Implements tools.jackson.core.ObjectWriteContext.getPrettyPrinter.

Accessor for getting PrettyPrinter instance to use for a new generator.

public SerializableString
public FormatSchema
public int
public boolean
hasPrettyPrinter()

Implements tools.jackson.core.ObjectWriteContext.hasPrettyPrinter.

Accessor similar to getPrettyPrinter() but which only indicates whether a non-null instance would be constructed if requested, or not.

public TokenStreamFactory
public void
public void
writeValue(JsonGenerator g, Object value)

Implements tools.jackson.core.ObjectWriteContext.writeValue.

Method that may be called to serialize given value, using specified token stream generator.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_CONTEXTback to summary
protected static ObjectWriteContext.Base EMPTY_CONTEXT

Constructor Detail

Baseback to summary
public Base()

Method Detail

_reportUnsupportedOperationback to summary
protected <T> T _reportUnsupportedOperation()
createArrayNodeback to summary
public ArrayTreeNode createArrayNode()

Implements tools.jackson.core.ObjectWriteContext.createArrayNode.

Doc from tools.jackson.core.ObjectWriteContext.createArrayNode.

Method for construct Array nodes for Tree Model instances.

Annotations
@Override
createObjectNodeback to summary
public ObjectTreeNode createObjectNode()

Implements tools.jackson.core.ObjectWriteContext.createObjectNode.

Doc from tools.jackson.core.ObjectWriteContext.createObjectNode.

Method for construct Object nodes for Tree Model instances.

Annotations
@Override
getCharacterEscapesback to summary
public CharacterEscapes getCharacterEscapes()

Implements tools.jackson.core.ObjectWriteContext.getCharacterEscapes.

Annotations
@Override
getFormatWriteFeaturesback to summary
public int getFormatWriteFeatures(int defaults)

Implements tools.jackson.core.ObjectWriteContext.getFormatWriteFeatures.

Annotations
@Override
getPrettyPrinterback to summary
public PrettyPrinter getPrettyPrinter()

Implements tools.jackson.core.ObjectWriteContext.getPrettyPrinter.

Doc from tools.jackson.core.ObjectWriteContext.getPrettyPrinter.

Accessor for getting PrettyPrinter instance to use for a new generator. Note that this MUST BE a thread-safe instance: that is, if the pretty printer implementation is stateful, a new unshared instance needs to be returned -- caller will NOT try to make a copy of tools.jackson.core.util.Instantiatable printers, context must do that.

Annotations
@Override
getRootValueSeparatorback to summary
public SerializableString getRootValueSeparator(SerializableString defaultSeparator)

Implements tools.jackson.core.ObjectWriteContext.getRootValueSeparator.

Annotations
@Override
getSchemaback to summary
public FormatSchema getSchema()

Implements tools.jackson.core.ObjectWriteContext.getSchema.

Annotations
@Override
getStreamWriteFeaturesback to summary
public int getStreamWriteFeatures(int defaults)

Implements tools.jackson.core.ObjectWriteContext.getStreamWriteFeatures.

Annotations
@Override
hasPrettyPrinterback to summary
public boolean hasPrettyPrinter()

Implements tools.jackson.core.ObjectWriteContext.hasPrettyPrinter.

Doc from tools.jackson.core.ObjectWriteContext.hasPrettyPrinter.

Accessor similar to getPrettyPrinter() but which only indicates whether a non-null instance would be constructed if requested, or not. This is useful for backends that have custom pretty-printing instead of relying on Jackson standard mechanism.

Annotations
@Override
tokenStreamFactoryback to summary
public TokenStreamFactory tokenStreamFactory()

Implements tools.jackson.core.ObjectWriteContext.tokenStreamFactory.

Annotations
@Override
writeTreeback to summary
public void writeTree(JsonGenerator g, TreeNode value)

Implements tools.jackson.core.ObjectWriteContext.writeTree.

Annotations
@Override
writeValueback to summary
public void writeValue(JsonGenerator g, Object value)

Implements tools.jackson.core.ObjectWriteContext.writeValue.

Doc from tools.jackson.core.ObjectWriteContext.writeValue.

Method that may be called to serialize given value, using specified token stream generator.

Annotations
@Override