ObjectMapper and can be
reused in completely thread-safe manner with no explicit synchronization
| Modifier and Type | Class and Description |
|---|---|
| public static class | ObjectWriter.
Helper class used for containing settings specifically related
to (re)configuring |
| public static class | ObjectWriter.
As a minor optimization, we will make an effort to pre-fetch a serializer,
or at least relevant |
| Modifier and Type | Field and Description |
|---|---|
| protected final SerializationConfig | _config
General serialization configuration settings |
| protected final JsonFactory | _generatorFactory
Factory used for constructing |
| protected final ObjectWriter. | _generatorSettings
Container for settings that need to be passed to |
| protected final ObjectWriter. | _prefetch
We may pre-fetch serializer if root type is known (has been explicitly declared), and if so, reuse it afterwards. |
| protected final SerializerFactory | |
| protected final DefaultSerializerProvider | |
| protected static final PrettyPrinter | NULL_PRETTY_PRINTER
We need to keep track of explicit disabling of pretty printing; easiest to do by a token value. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| protected | ObjectWriter(ObjectMapper mapper, SerializationConfig config, JavaType rootType, PrettyPrinter pp)
Constructor used by |
| protected | ObjectWriter(ObjectMapper mapper, SerializationConfig config)
Alternative constructor for initial instantiation by |
| protected | ObjectWriter(ObjectMapper mapper, SerializationConfig config, FormatSchema s)
Alternative constructor for initial instantiation by |
| protected | ObjectWriter(ObjectWriter base, SerializationConfig config, ObjectWriter.
Copy constructor used for building variations. |
| protected | ObjectWriter(ObjectWriter base, SerializationConfig config)
Copy constructor used for building variations. |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | |
| protected final JsonGenerator | _configureGenerator(JsonGenerator gen)
Helper method called to set or override settings of passed-in
|
| protected ObjectWriter | _new(ObjectWriter base, JsonFactory f)
Overridable factory method called by various "withXxx()" methods |
| protected ObjectWriter | _new(ObjectWriter base, SerializationConfig config)
Overridable factory method called by various "withXxx()" methods |
| protected ObjectWriter | _new(ObjectWriter.
Overridable factory method called by various "withXxx()" methods. |
| protected SequenceWriter | _newSequenceWriter(boolean wrapInArray, JsonGenerator gen, boolean managedInput)
Overridable factory method called by |
| protected DefaultSerializerProvider | _serializerProvider()
Overridable helper method used for constructing
|
| protected void | |
| private final void | _writeCloseable(JsonGenerator gen, Object value)
Helper method used when value to serialize is |
| protected final void | _writeValueAndClose(JsonGenerator gen, Object value)
Method called to configure the generator as necessary and then call write functionality |
| public void | acceptJsonFormatVisitor(JavaType
Type to generate schema for (possibly with generic signature) type, JsonFormatVisitorWrapper visitor)Method for visiting type hierarchy for given type, using specified visitor. |
| public void | |
| public boolean | canSerialize(Class<?> type)
Deprecated
Since 2.18 use discouraged; method to be removed from Jackson 3.0
Method that can be called to check whether |
| public boolean | canSerialize(Class<?> type, AtomicReference<Throwable> cause)
Deprecated
Since 2.18 use discouraged; method to be removed from Jackson 3.0
Method for checking whether instances of given type can be serialized,
and optionally why (as per |
| public JsonGenerator | createGenerator(OutputStream out)
Factory method for constructing properly initialized |
| public JsonGenerator | createGenerator(OutputStream out, JsonEncoding enc)
Factory method for constructing properly initialized |
| public JsonGenerator | createGenerator(Writer w)
Factory method for constructing properly initialized |
| public JsonGenerator | createGenerator(File outputFile, JsonEncoding enc)
Factory method for constructing properly initialized |
| public JsonGenerator | createGenerator(DataOutput out)
Factory method for constructing properly initialized |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | forType(TypeReference<?> rootType)
Method that will construct a new instance that uses specific type as the root type for serialization, instead of runtime dynamic type of the root object itself. |
| public ContextAttributes | |
| public SerializationConfig | |
| public JsonFactory | |
| public TypeFactory | |
| public boolean | hasPrefetchedSerializer()
Diagnostics method that can be called to check whether this writer has pre-fetched serializer to use: pre-fetching improves performance when writer instances are reused as it avoids a per-call serializer lookup. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public Version | version()
Implements com. Method that will return version information stored in and read from jar that contains this class. |
| public ObjectWriter | with(SerializationFeature feature)
Method for constructing a new instance that is configured with specified feature enabled. |
| public ObjectWriter | with(SerializationFeature first, SerializationFeature... other)
Method for constructing a new instance that is configured with specified features enabled. |
| public ObjectWriter | with(DatatypeFeature feature)
Method for constructing a new instance that is configured with specified feature enabled. |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | with(DateFormat df)
Fluent factory method that will construct a new writer instance that will use specified date format for serializing dates; or if null passed, one that will serialize dates as numeric timestamps. |
| public ObjectWriter | with(FilterProvider filterProvider)
Method that will construct a new instance that uses specified provider for resolving filter instances by id. |
| public ObjectWriter | with(PrettyPrinter pp)
Method that will construct a new instance that will use specified pretty printer (or, if null, will not do any pretty-printing) |
| public ObjectWriter | with(FormatSchema schema)
Method that will construct a new instance that uses specific format schema for serialization. |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | with(Base64Variant b64variant)
Method that will construct a new instance that uses specified default
|
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | withAttributes(Map<?, ?> attrs)
Mutant factory method that allows construction of a new writer instance that uses specified set of default attribute values. |
| public ObjectWriter | withDefaultPrettyPrinter()
Method that will construct a new instance that will use the default pretty printer for serialization. |
| public ObjectWriter | withFeatures(SerializationFeature... features)
Method for constructing a new instance that is configured with specified features enabled. |
| public ObjectWriter | withFeatures(DatatypeFeature... features)
Method for constructing a new instance that is configured with specified features enabled. |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | without(SerializationFeature feature)
Method for constructing a new instance that is configured with specified feature disabled. |
| public ObjectWriter | without(SerializationFeature first, SerializationFeature... other)
Method for constructing a new instance that is configured with specified features disabled. |
| public ObjectWriter | without(DatatypeFeature feature)
Method for constructing a new instance that is configured with specified feature disabled. |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | withoutFeatures(SerializationFeature... features)
Method for constructing a new instance that is configured with specified features disabled. |
| public ObjectWriter | withoutFeatures(DatatypeFeature... features)
Method for constructing a new instance that is configured with specified features disabled. |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | withoutRootName()
Convenience method that is same as calling:
|
| public ObjectWriter | withRootName(String
Root name to use, if non-empty; `null` for "use defaults",
and empty String ("") for "do NOT add root wrapper" rootName)Method for constructing a new instance with configuration that specifies what root name to use for "root element wrapping". |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public ObjectWriter | |
| public void | writeValue(JsonGenerator g, Object value)
Method that can be used to serialize any Java value as
JSON output, using provided |
| public void | writeValue(File resultFile, Object value)
Method that can be used to serialize any Java value as JSON output, written to File provided. |
| public void | writeValue(OutputStream out, Object value)
Method that can be used to serialize any Java value as
JSON output, using output stream provided (using encoding
|
| public void | writeValue(Writer w, Object value)
Method that can be used to serialize any Java value as JSON output, using Writer provided. |
| public void | |
| public byte[] | |
| public String | |
| public SequenceWriter | writeValues(File
Target file to write value sequence to. out)Method for creating a |
| public SequenceWriter | writeValues(JsonGenerator
Low-level generator caller has already constructed that will
be used for actual writing of token stream. g)Method for creating a |
| public SequenceWriter | writeValues(Writer
Target writer to use for writing the token stream out)Method for creating a |
| public SequenceWriter | writeValues(OutputStream
Physical output stream to use for writing the token stream out)Method for creating a |
| public SequenceWriter | |
| public SequenceWriter | writeValuesAsArray(File
File to write token stream to out)Method for creating a |
| public SequenceWriter | writeValuesAsArray(JsonGenerator
Underlying generator to use for writing the token stream gen)Method for creating a |
| public SequenceWriter | writeValuesAsArray(Writer
Writer to use for writing the token stream out)Method for creating a |
| public SequenceWriter | writeValuesAsArray(OutputStream
Physical output stream to use for writing the token stream out)Method for creating a |
| public SequenceWriter |