public class StreamWriteConstraints
extends java.lang.Object
implements java.io.Serializable
TokenStreamFactory (such as
JsonFactory); if nothing explicitly specified, default
constraints are used.
Currently constrained aspects, with default settings, are:
DEFAULT_MAX_DEPTH)
| Modifier and Type | Class and Description |
|---|---|
static class |
StreamWriteConstraints.Builder |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_DEPTH
Default setting for maximum depth: see
StreamWriteConstraints.Builder.maxNestingDepth(int) for details. |
| Modifier and Type | Method and Description |
|---|---|
static StreamWriteConstraints.Builder |
builder() |
static StreamWriteConstraints |
defaults() |
int |
getMaxNestingDepth()
Accessor for maximum depth.
|
static void |
overrideDefaultStreamWriteConstraints(StreamWriteConstraints streamWriteConstraints)
Override the default StreamWriteConstraints.
|
StreamWriteConstraints.Builder |
rebuild() |
void |
validateNestingDepth(int depth)
Convenience method that can be used to verify that the
nesting depth does not exceed the maximum specified by this
constraints object: if it does, a
StreamConstraintsException
is thrown. |
public static final int DEFAULT_MAX_DEPTH
StreamWriteConstraints.Builder.maxNestingDepth(int) for details.public static void overrideDefaultStreamWriteConstraints(StreamWriteConstraints streamWriteConstraints)
JsonFactory
instances are not configured with their own StreamWriteConstraints.
Library maintainers should not set this as it will affect other code that uses Jackson.
Library maintainers who want to configure StreamWriteConstraints for the Jackson usage within their
lib should create ObjectMapper instances that have a JsonFactory instance with
the required StreamWriteConstraints.
This method is meant for users delivering applications. If they use this, they set it when they start their application to avoid having other code initialize their mappers before the defaults are overridden.
streamWriteConstraints - new default for StreamWriteConstraints (a null value will reset to built-in default)defaults(),
builder()public static StreamWriteConstraints.Builder builder()
public static StreamWriteConstraints defaults()
StreamWriteConstraints (when none is set on the JsonFactory explicitly)overrideDefaultStreamWriteConstraints(StreamWriteConstraints)public StreamWriteConstraints.Builder rebuild()
StreamWriteConstraints.Builder initialized with settings of this constraints
instancepublic int getMaxNestingDepth()
StreamWriteConstraints.Builder.maxNestingDepth(int) for details.public void validateNestingDepth(int depth)
throws StreamConstraintsException
StreamConstraintsException
is thrown.depth - count of unclosed objects and arraysStreamConstraintsException - If depth exceeds maximumCopyright © 2010 - 2024 Adobe. All Rights Reserved