Top Description Fields Constructors Methods
com.fasterxml.jackson.core

public Class JsonFactoryBuilder

extends TSFBuilder<JsonFactory, JsonFactoryBuilder>
Class Inheritance
Imports
com.fasterxml.jackson.core.io.CharacterEscapes, .SerializedString, com.fasterxml.jackson.core.json.JsonReadFeature, .JsonWriteFeature

com.fasterxml.jackson.core.TSFBuilder implementation for constructing vanilla JsonFactory instances for reading/writing JSON encoded content.

Note

as of Jackson 2.x, use of JSON-specific builder is bit cumbersome since JsonFactory serves dual duty of base class AND actual implementation for JSON backend. This will be fixed in Jackson 3.0.

Since
2.10

Field Summary

Modifier and TypeField and Description
protected CharacterEscapes
protected int
protected char
_quoteChar

Character used for quoting field names (if field name quoting has not been disabled with JsonWriteFeature#QUOTE_FIELD_NAMES) and JSON String values.

protected SerializableString
Inherited from com.fasterxml.jackson.core.TSFBuilder:
_errorReportConfiguration_factoryFeatures_generatorDecorators_inputDecorator_outputDecorator_recyclerPool_streamReadConstraints_streamReadFeatures_streamWriteConstraints_streamWriteFeaturesDEFAULT_FACTORY_FEATURE_FLAGSDEFAULT_GENERATOR_FEATURE_FLAGSDEFAULT_PARSER_FEATURE_FLAGS

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public JsonFactory
build()

Implements abstract com.fasterxml.jackson.core.TSFBuilder.build.

Method for constructing actual TokenStreamFactory instance, given configuration.
public JsonFactoryBuilder

Returns:

This builder instance (to allow call chaining)
characterEscapes
(CharacterEscapes
CharacterEscapes to configure, if any; null if none
esc
)

Method for defining custom escapes factory uses for JsonGenerators it creates.

public CharacterEscapes
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder
public JsonFactoryBuilder

Returns:

This builder instance (to allow call chaining)
highestNonEscapedChar
(int
Highest character code that is NOT automatically escaped; if positive value above 0, or 0 to indicate that no automatic escaping is applied beside from what JSON specification requires (and possible custom escape settings). Values between 1 and 127 are all taken to behave as if 127 is specified: that is, no automatic escaping is applied in ASCII range.
maxNonEscaped
)

Method that allows specifying threshold beyond which all characters are automatically escaped (without checking possible custom escaping settings a la characterEscapes: for example, to force escaping of all non-ASCII characters (set to 127), or all non-Latin-1 character (set to 255).

public int
public JsonFactoryBuilder

Returns:

This builder instance (to allow call chaining)
quoteChar
(char
Character to use for quoting field names and JSON String values.
ch
)

Method that allows specifying an alternate character used for quoting field names (if field name quoting has not been disabled with JsonWriteFeature#QUOTE_FIELD_NAMES) and JSON String values.

public char
public JsonFactoryBuilder

Returns:

This builder instance (to allow call chaining)
rootValueSeparator
(String
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 JsonFactoryBuilder

Returns:

This builder instance (to allow call chaining)
rootValueSeparator
(SerializableString
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 SerializableString
Inherited from com.fasterxml.jackson.core.TSFBuilder:
_copy_legacyDisable_legacyDisable_legacyEnable_legacyEnable_thisaddDecoratorconfigureconfigureconfiguredisabledisabledisabledisabledisableenableenableenableenableenableerrorReportConfigurationfactoryFeaturesMaskinputDecoratorinputDecoratoroutputDecoratoroutputDecoratorrecyclerPoolrecyclerPoolstreamReadConstraintsstreamReadFeaturesstreamWriteConstraintsstreamWriteFeatures

Field Detail

_characterEscapesback to summary
protected CharacterEscapes _characterEscapes
_maximumNonEscapedCharback to summary
protected int _maximumNonEscapedChar
_quoteCharback to summary
protected char _quoteChar

Character used for quoting field names (if field name quoting has not been disabled with JsonWriteFeature#QUOTE_FIELD_NAMES) and JSON String values.

_rootValueSeparatorback to summary
protected SerializableString _rootValueSeparator

Constructor Detail

JsonFactoryBuilderback to summary
public JsonFactoryBuilder()
JsonFactoryBuilderback to summary
public JsonFactoryBuilder(JsonFactory base)

Method Detail

buildback to summary
public JsonFactory build()

Implements abstract com.fasterxml.jackson.core.TSFBuilder.build.

Doc from com.fasterxml.jackson.core.TSFBuilder.build.

Method for constructing actual TokenStreamFactory instance, given configuration.

Returns:JsonFactory

TokenStreamFactory build based on current configuration

Annotations
@Override
characterEscapesback to summary
public JsonFactoryBuilder characterEscapes(CharacterEscapes esc)

Method for defining custom escapes factory uses for JsonGenerators it creates.

Parameters
esc:CharacterEscapes

CharacterEscapes to configure, if any; null if none

Returns:JsonFactoryBuilder

This builder instance (to allow call chaining)

characterEscapesback to summary
public CharacterEscapes characterEscapes()
configureback to summary
public JsonFactoryBuilder configure(JsonReadFeature f, boolean state)

Overrides com.fasterxml.jackson.core.TSFBuilder.configure.

Annotations
@Override
configureback to summary
public JsonFactoryBuilder configure(JsonWriteFeature f, boolean state)

Overrides com.fasterxml.jackson.core.TSFBuilder.configure.

Annotations
@Override
disableback to summary
public JsonFactoryBuilder disable(JsonReadFeature f)

Overrides com.fasterxml.jackson.core.TSFBuilder.disable.

Annotations
@Override
disableback to summary
public JsonFactoryBuilder disable(JsonReadFeature first, JsonReadFeature... other)

Overrides com.fasterxml.jackson.core.TSFBuilder.disable.

Annotations
@Override
disableback to summary
public JsonFactoryBuilder disable(JsonWriteFeature f)

Overrides com.fasterxml.jackson.core.TSFBuilder.disable.

Annotations
@Override
disableback to summary
public JsonFactoryBuilder disable(JsonWriteFeature first, JsonWriteFeature... other)

Overrides com.fasterxml.jackson.core.TSFBuilder.disable.

Annotations
@Override
enableback to summary
public JsonFactoryBuilder enable(JsonReadFeature f)

Overrides com.fasterxml.jackson.core.TSFBuilder.enable.

Annotations
@Override
enableback to summary
public JsonFactoryBuilder enable(JsonReadFeature first, JsonReadFeature... other)

Overrides com.fasterxml.jackson.core.TSFBuilder.enable.

Annotations
@Override
enableback to summary
public JsonFactoryBuilder enable(JsonWriteFeature f)

Overrides com.fasterxml.jackson.core.TSFBuilder.enable.

Annotations
@Override
enableback to summary
public JsonFactoryBuilder enable(JsonWriteFeature first, JsonWriteFeature... other)

Overrides com.fasterxml.jackson.core.TSFBuilder.enable.

Annotations
@Override
highestNonEscapedCharback to summary
public JsonFactoryBuilder highestNonEscapedChar(int maxNonEscaped)

Method that allows specifying threshold beyond which all characters are automatically escaped (without checking possible custom escaping settings a la characterEscapes: for example, to force escaping of all non-ASCII characters (set to 127), or all non-Latin-1 character (set to 255). Default setting is "disabled", specified by passing value of 0 (or negative numbers).

Note

Lowest legal value (aside from marker 0) is 127: for ASCII range, other checks apply and this threshold is ignored. If value between [1, 126] is specified, 127 will be used instead.

Parameters
maxNonEscaped:int

Highest character code that is NOT automatically escaped; if positive value above 0, or 0 to indicate that no automatic escaping is applied beside from what JSON specification requires (and possible custom escape settings). Values between 1 and 127 are all taken to behave as if 127 is specified: that is, no automatic escaping is applied in ASCII range.

Returns:JsonFactoryBuilder

This builder instance (to allow call chaining)

highestNonEscapedCharback to summary
public int highestNonEscapedChar()
quoteCharback to summary
public JsonFactoryBuilder quoteChar(char ch)

Method that allows specifying an alternate character used for quoting field names (if field name quoting has not been disabled with JsonWriteFeature#QUOTE_FIELD_NAMES) and JSON String values.

Default value is double-quote ("); typical alternative is single-quote/apostrophe (').

Parameters
ch:char

Character to use for quoting field names and JSON String values.

Returns:JsonFactoryBuilder

This builder instance (to allow call chaining)

quoteCharback to summary
public char quoteChar()
rootValueSeparatorback to summary
public JsonFactoryBuilder rootValueSeparator(String sep)

Method that allows overriding String used for separating root-level JSON values (default is single space character)

Parameters
sep:String

Separator to use, if any; null means that no separator is automatically added

Returns:JsonFactoryBuilder

This builder instance (to allow call chaining)

rootValueSeparatorback to summary
public JsonFactoryBuilder rootValueSeparator(SerializableString sep)

Method that allows overriding String used for separating root-level JSON values (default is single space character)

Parameters
sep:SerializableString

Separator to use, if any; null means that no separator is automatically added

Returns:JsonFactoryBuilder

This builder instance (to allow call chaining)

rootValueSeparatorback to summary
public SerializableString rootValueSeparator()