JsonParser)
and
writer (aka generator, JsonGenerator)
instances.
Factory instances are thread-safe and reusable after configuration (if any). Typically applications and services use only a single globally shared factory instance, unless they need differently configured factories. Factory reuse is important if efficiency matters; most recycling of expensive construct is done on per-factory basis.
Creation of a factory instance is a light-weight operation, and since there is no need for pluggable alternative implementations (as there is no "standard" JSON processor API to implement), the default constructor is used for constructing factory instances.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | JsonFactory.Feature
Enumeration that defines all on/off features that can only be
changed for |
| Modifier and Type | Field and Description |
|---|---|
| protected final transient ByteQuadsCanonicalizer | _byteSymbolCanonicalizer
Alternative to the basic symbol table, some stream-based parsers use different name canonicalization method. |
| protected CharacterEscapes | _characterEscapes
Definition of custom character escapes to use for generators created by this factory, if any. |
| protected ErrorReportConfiguration | _errorReportConfiguration
Container for configuration values used when handling erroneous token inputs. |
| protected int | _factoryFeatures
Currently enabled factory features. |
| protected final List | _generatorDecorators
List of |
| protected int | _generatorFeatures
Currently enabled generator features. |
| protected InputDecorator | _inputDecorator
Optional helper object that may decorate input sources, to do additional processing on input during parsing. |
| protected int | _maximumNonEscapedChar
Optional threshold used for automatically escaping character above certain character
code value: either |
| protected ObjectCodec | _objectCodec
Object that implements conversion functionality between Java objects and JSON content. |
| protected OutputDecorator | _outputDecorator
Optional helper object that may decorate output object, to do additional processing on output during content generation. |
| protected int | _parserFeatures
Currently enabled parser features. |
| protected final char | _quoteChar
Character used for quoting field names (if field name quoting has not
been disabled with |
| protected RecyclerPool | |
| protected final transient CharsToNameCanonicalizer | _rootCharSymbols
Each factory comes equipped with a shared root symbol table. |
| protected SerializableString | _rootValueSeparator
Separator used between root-level values, if any; null indicates "do not add separator". |
| protected StreamReadConstraints | _streamReadConstraints
Read constraints to use for |
| protected StreamWriteConstraints | _streamWriteConstraints
Write constraints to use for |
| protected static final int | DEFAULT_FACTORY_FEATURE_FLAGS
Bitfield (set of flags) of all factory features that are enabled by default. |
| protected static final int | DEFAULT_GENERATOR_FEATURE_FLAGS
Bitfield (set of flags) of all generator features that are enabled by default. |
| protected static final int | DEFAULT_PARSER_FEATURE_FLAGS
Bitfield (set of flags) of all parser features that are enabled by default. |
| public static final char | |
| public static final SerializableString | |
| public static final String | FORMAT_NAME_JSON
Name used to identify JSON format
(and returned by |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| protected | JsonFactory(JsonFactory
Original factory to copy settings from src, ObjectCodec Databinding-level codec to use, if any codec)Constructor used when copy()ing a factory instance. |
| public | JsonFactory(JsonFactoryBuilder
Builder that contains settings to use b)Constructor used by |
| protected | JsonFactory(TSFBuilder<?, ?>
Builder that contains settings to use b, boolean Argument only needed to separate constructor signature; ignored bogus)Constructor for subtypes; needed to work around the fact that before 3.0, this factory has cumbersome dual role as generic type as well as actual implementation for json. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected static <T> List | |
| protected ContentReference | Returns: Reference instance to useAccess to underlying content; depends on source/target,
as well as content representation contentAccessor)Overridable factory method for constructing |
| protected ContentReference | Returns: Reference instance to useAccess to underlying content; depends on source/target,
as well as content representation contentAccessor, int Offset of content offset, int Length of content length)Overridable factory method for constructing |
| protected IOContext | Returns: I/O context createdSource/target reference to use for diagnostics, exception messages contentRef, boolean Whether input/output buffer is managed by this factory or not resourceManaged)Overridable factory method that actually instantiates desired context object. |
| protected IOContext | Returns: I/O context created"Raw" source/target reference rawContentRef, boolean Whether input/output buffer is managed by this factory or not resourceManaged)
Deprecated
Since 2.13
Deprecated variant of _createContext(Object, boolean)
|
| protected JsonGenerator | Returns: This factory instance (to allow call chaining)Writer underlying writer to write generated content to out, IOContext I/O context to use ctxt)Overridable factory method that actually instantiates generator for
given |
| protected IOContext | Returns: I/O context createdSource reference to use for diagnostics, exception messages srcRef)Overridable factory method that actually instantiates desired context object for async (non-blocking) parsing |
| protected JsonParser | Returns: Parser constructedInputStream to use for reading content to parse in, IOContext I/O context to use for parsing ctxt)Overridable factory method that actually instantiates desired parser
given |
| protected JsonParser | Returns: Actual parser to useReader to use for reading content to parse r, IOContext I/O context to use for parsing ctxt)Overridable factory method that actually instantiates parser
using given |
| protected JsonParser | Returns: Actual parser to useBuffer that contains content to parse data, int Offset to the first character of data to parse offset, int Number of characters within buffer to parse len, IOContext I/O context to use for parsing ctxt, boolean Whether input buffer is recycled by the factory recyclable)Overridable factory method that actually instantiates parser
using given |
| protected JsonParser | Returns: Actual parser to useBuffer that contains content to parse data, int Offset to the first character of data to parse offset, int Number of characters within buffer to parse len, IOContext I/O context to use for parsing ctxt)Overridable factory method that actually instantiates parser
using given |
| protected JsonParser | Returns: Actual parser to useDataInput to use for reading content to parse input, IOContext I/O context to use for parsing ctxt)Optional factory method, expected to be overridden |
| protected JsonGenerator | Returns: This factory instance (to allow call chaining)OutputStream underlying writer to write generated content to out, IOContext I/O context to use ctxt)Overridable factory method that actually instantiates generator for
given |
| protected Writer | |
| protected final InputStream | |
| protected final Reader | |
| protected final DataInput | |
| protected final OutputStream | |
| protected final Writer | |
| protected JsonGenerator | Returns: Generator after applying all registeredJsonGeneratorDecorators.Generator constructed that is to be decorated g)Helper method for applying all registered |
| public BufferRecycler | Returns: Buffer recycler instance to useMethod used by factory to create buffer recycler instances for parsers and generators. |
| public RecyclerPool | Returns: RecyclerPool to use.Accessor for getting access to |
| private final boolean | |
| private final void | _requireJSONFactory(String
Message template to use for reporting problem (if necessary) msg)Helper method called to work around the problem of this class both defining general API for constructing parsers+generators AND implementing the API for JSON handling. |
| public static TSFBuilder | Returns: Builder instance to useMain factory method to use for constructing |
| public boolean | Returns: Whether format supported by this factory supports native binary contentImplements abstract com. |
| public boolean | Returns: Whether this factory supports non-blocking ("async") parsing or not (and consequently whethercreateNonBlockingXxx() method(s) work)Implements abstract com. com..
|
| public boolean | Returns: Whether access to decoded textual content can be efficiently accessed using parser methodgetTextCharacters().Introspection method that can be used by base factory to check
whether access using |
| public boolean | Returns: Whether parsers and generators constructed by this factory can use specified format schema instanceSchema instance to check schema)Implements abstract com. |
| public final JsonFactory | Returns: This factory instance (to allow call chaining)Feature to enable/disable f,Whether to enable or disable the feature state)
Deprecated
since 2.10 use
Method for enabling or disabling specified parser feature
(check JsonFactoryBuilder#configure(JsonFactory. instead
JsonParser. for list of features)
|
| public final JsonFactory | Returns: This factory instance (to allow call chaining)Feature to enable/disable f,Whether to enable or disable the feature state)Method for enabling or disabling specified parser feature
(check |
| public final JsonFactory | Returns: This factory instance (to allow call chaining)Feature to enable/disable f,Whether to enable or disable the feature state)Method for enabling or disabling specified generator feature
(check |
| public JsonFactory | Returns: Copy of this factory instanceMethod for constructing a new |
| public JsonGenerator | createGenerator(OutputStream
OutputStream to use for writing JSON content out, JsonEncoding Character encoding to use enc)Implements abstract com. |
| public JsonGenerator | createGenerator(OutputStream out)
Implements abstract com. |
| public JsonGenerator | createGenerator(Writer
Writer to use for writing JSON content w)Implements abstract com. |
| public JsonGenerator | createGenerator(File
File to write contents to f, JsonEncoding Character encoding to use enc)Implements abstract com. |
| public JsonGenerator | createGenerator(DataOutput out, JsonEncoding enc)
Implements abstract com. DataOutput instance.
|
| public JsonGenerator | createGenerator(DataOutput out)
Implements abstract com. |
| public JsonGenerator | Returns: Generator constructedOutputStream to use for writing JSON content out, JsonEncoding Character encoding to use enc)
Deprecated
Since 2.2, use
Method for constructing JSON generator for writing JSON content
using specified output stream.
createGenerator(OutputStream, JsonEncoding) instead.
|
| public JsonGenerator | Returns: Generator constructedWriter to use for writing JSON content out)
Deprecated
Since 2.2, use
Method for constructing JSON generator for writing JSON content
using specified Writer.
createGenerator(Writer) instead.
|
| public JsonGenerator | Returns: Generator constructedOutputStream to use for writing JSON content out)
Deprecated
Since 2.2, use
Convenience method for constructing generator that uses default
encoding of the format (UTF-8 for JSON and most other data formats).
createGenerator(OutputStream) instead.
|
| public JsonParser | Returns: Parser constructedFile that contains JSON content to parse f)
Deprecated
Since 2.2, use
Method for constructing JSON parser instance to parse
contents of specified file.
createParser(File) instead.
|
| public JsonParser | Returns: Parser constructedURL pointing to resource that contains JSON content to parse url)
Deprecated
Since 2.2, use
Method for constructing JSON parser instance to parse
contents of resource reference by given URL.
createParser(URL) instead.
|
| public JsonParser | Returns: Parser constructedInputStream to use for reading JSON content to parse in)
Deprecated
Since 2.2, use
Method for constructing JSON parser instance to parse
the contents accessed via specified input stream.
createParser(InputStream) instead.
|
| public JsonParser | Returns: Parser constructedReader to use for reading JSON content to parse r)
Deprecated
Since 2.2, use
Method for constructing parser for parsing
the contents accessed via specified Reader.
createParser(Reader) instead.
|
| public JsonParser | Returns: Parser constructedInput content to parse data)
Deprecated
Since 2.2, use
Method for constructing parser for parsing the contents of given byte array.
createParser(byte[]) instead.
|
| public JsonParser | Returns: Parser constructedBuffer that contains data to parse data, int Offset of the first data byte within buffer offset, int Length of contents to parse within buffer len)
Deprecated
Since 2.2, use
Method for constructing parser for parsing
the contents of given byte array.
createParser(byte[], int, int) instead.
|
| public JsonParser | Returns: Parser constructedInput content to parse content)
Deprecated
Since 2.2, use
Method for constructing parser for parsing
contents of given String.
createParser(String) instead.
|
| public JsonParser | createNonBlockingByteArrayParser()
Implements abstract com. com.
interface (accessed using JsonParser#getNonBlockingInputFeeder()
from constructed instance).
|
| public JsonParser | createNonBlockingByteBufferParser()
Implements abstract com. com.
interface (accessed using JsonParser#getNonBlockingInputFeeder()
from constructed instance).
|
| public JsonParser | createParser(File
File that contains JSON content to parse f)Implements abstract com. |
| public JsonParser | createParser(URL
URL pointing to resource that contains JSON content to parse url)Implements abstract com. |
| public JsonParser | createParser(InputStream
InputStream to use for reading JSON content to parse in)Implements abstract com. |
| public JsonParser | createParser(Reader
Reader to use for reading JSON content to parse r)Implements abstract com. |
| public JsonParser | createParser(byte[] data)
Implements abstract com. |
| public JsonParser | createParser(byte[]
Buffer that contains data to parse data, int Offset of the first data byte within buffer offset, int Length of contents to parse within buffer len)Implements abstract com. |
| public JsonParser | createParser(String content)
Implements abstract com. |
| public JsonParser | createParser(char[] content)
Implements abstract com. |
| public JsonParser | createParser(char[] content, int offset, int len)
Implements abstract com. |
| public JsonParser | createParser(DataInput in)
Implements abstract com. DataInput
instance.
|
| public JsonFactory | Returns: This factory instance (to allow call chaining)Feature to disable f
Deprecated
since 2.10 use
Method for disabling specified parser features
(check JsonFactoryBuilder#configure(JsonFactory. instead
JsonFactory. for list of features)
|
| public JsonFactory | Returns: This factory instance (to allow call chaining)Feature to disable fMethod for disabling specified parser features
(check |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Feature to disable fMethod for disabling specified generator feature
(check |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Feature to enable f
Deprecated
since 2.10 use
Method for enabling specified parser feature
(check JsonFactoryBuilder#configure(JsonFactory. instead
JsonFactory. for list of features)
|
| public JsonFactory | Returns: This factory instance (to allow call chaining)Feature to enable fMethod for enabling specified parser feature
(check |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Feature to enable fMethod for enabling specified generator features
(check |
| public CharacterEscapes | Returns: ConfiguredCharacterEscapes, if any; null if noneMethod for accessing custom escapes factory uses for |
| public ObjectCodec | |
| public final int | getFactoryFeatures()
Implements abstract com. JsonFactory.s enabled
|
| public int | |
| public String | Returns: Name of the format handled by parsers, generators this factory createsImplements abstract com. |
| public int | getFormatParserFeatures()
Implements abstract com. |
| public Class | getFormatReadFeatureType()
Implements abstract com. FormatFeature that a parser
JsonParser produced by this factory would accept, if any;
null returned if none.
|
| public Class | getFormatWriteFeatureType()
Implements abstract com. FormatFeature that a parser
JsonGenerator produced by this factory would accept, if any;
null returned if none.
|
| public final int | getGeneratorFeatures()
Implements abstract com. |
| public InputDecorator | Returns: InputDecorator configured, if anyMethod for getting currently configured input decorator (if any; there is no default decorator). |
| public OutputDecorator | Returns: OutputDecorator configured for generators factory creates, if any;null if none.Method for getting currently configured output decorator (if any; there is no default decorator). |
| public final int | getParserFeatures()
Implements abstract com. |
| public String | |
| public MatchStrength | |
| protected MatchStrength | |
| public final boolean | Returns: True if the specified feature is enabledFeature to check fImplements abstract com. |
| public final boolean | Returns: True if specified feature is enabledFeature to check fImplements abstract com. |
| public final boolean | Returns: True if specified feature is enabledFeature to check f)Implements abstract com. |
| public final boolean | Returns: Whether specified feature is enabledFeature to check fImplements abstract com. |
| public final boolean | Returns: Whether specified feature is enabledFeature to check f)Implements abstract com. |
| protected Object | Returns: Newly constructed instanceMethod that we need to override to actually make restoration go through constructors etc: needed to allow JDK serializability of factory instances. |
| public TSFBuilder | Returns: Builder instance to useMethod that allows construction of differently configured factory, starting with settings of this factory. |
| public boolean | Returns: True if custom codec is needed with parsers and generators created by this factory; false if a generalObjectCodec is enoughMethod that can be called to determine if a custom
|
| public boolean | Returns: Whether format supported by this factory requires Object properties to be ordered.Implements abstract com. |
| public JsonFactory | Returns: This factory instance (to allow call chaining)CharaterEscapes to set (or esc)null for "none")Method for defining custom escapes factory uses for |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Codec to use oc)Method for associating a |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Configuration src)Method for overriding |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Decorator to configure for this factory, if any ( d)null if none)
Deprecated
Since 2.10 use
Method for overriding currently configured input decorator
JsonFactoryBuilder#inputDecorator(InputDecorator) instead
|
| public JsonFactory | Returns: This factory instance (to allow call chaining)Output decorator to use, if any d)
Deprecated
Since 2.10 use
Method for overriding currently configured output decorator
JsonFactoryBuilder#outputDecorator(OutputDecorator) instead
|
| public JsonFactory | |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Separator to use, if any; null means that no separator is
automatically added sep)Method that allows overriding String used for separating root-level JSON values (default is single space character) |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Constraints src)Method for overriding |
| public JsonFactory | Returns: This factory instance (to allow call chaining)Constraints swc)Method for overriding |
| public StreamReadConstraints | streamReadConstraints()
Implements abstract com. |
| public StreamWriteConstraints | streamWriteConstraints()
Implements abstract com. |
| public Version | version()
Implements com. Version for details).
|