Top Fields Constructors Methods
tools.jackson.dataformat.yaml

public Class YAMLFactory

extends TextualTSFactory
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Annotations
@SuppressWarnings:resource
Imports
java.io.*, org.snakeyaml.engine.v2.api.DumpSettings, .LoadSettings, org.snakeyaml.engine.v2.common.SpecVersion, tools.jackson.core.*, tools.jackson.core.base.TextualTSFactory, tools.jackson.core.io.IOContext, tools.jackson.dataformat.yaml.util.StringQuotingChecker

Field Summary

Modifier and TypeField and Description
protected final DumpSettings
_dumpSettings

Configuration for underlying generator to follow, if specified; left as null for backwards compatibility (which means the dumper options are derived based on YAMLWriteFeatures).

protected final LoadSettings
_loadSettings

Configuration for underlying parser to follow, if specified; left as null for backwards compatibility (which means whatever default settings snakeyaml-engine deems best).

protected final StringQuotingChecker
_quotingChecker

Helper object used to determine whether property names, String values must be quoted or not.

protected final SpecVersion
_version

YAML version for underlying generator to follow, if specified.

protected static final int
DEFAULT_YAML_GENERATOR_FEATURE_FLAGS

Bitfield (set of flags) of all generator features that are enabled by default.

protected static final int
DEFAULT_YAML_PARSER_FEATURE_FLAGS

Bitfield (set of flags) of all generator features that are enabled by default.

public static final String
FORMAT_NAME_YAML

Name used to identify YAML format.

private static final long

Constructor Summary

AccessConstructor and Description
public
YAMLFactory()

Default constructor used to create factory instances that may be used to construct an instance with default settings, instead of using YAMLFactoryBuilder.

public
protected
YAMLFactory(YAMLFactoryBuilder b)

Constructors used by YAMLFactoryBuilder for instantiation.

Method Summary

Modifier and TypeMethod and Description
protected YAMLGenerator
_createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, Writer out)

Implements abstract tools.jackson.core.base.TextualTSFactory._createGenerator.

Overridable factory method that actually instantiates generator for given Writer and context object.

protected YAMLParser
protected YAMLParser
protected YAMLParser
_createParser(ObjectReadContext readCtxt, IOContext ioCtxt, char[] data, int offset, int len, boolean recyclable)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

protected YAMLParser
_createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

protected JsonParser
protected Reader
protected Reader
_createReader(byte[] data, int offset, int len, JsonEncoding enc, IOContext ctxt)

protected YAMLGenerator
_createUTF8Generator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out)

Implements abstract tools.jackson.core.base.TextualTSFactory._createUTF8Generator.

Overridable factory method that actually instantiates generator for given OutputStream and context object, using UTF-8 encoding.

protected Writer
public static YAMLFactoryBuilder
builder()

Main factory method to use for constructing YAMLFactory instances with different configuration.

public boolean
canParseAsync()

Implements abstract tools.jackson.core.TokenStreamFactory.canParseAsync.

Introspection method that can be used to check whether this factory can create non-blocking parsers: parsers that do not use blocking I/O abstractions but instead use a tools.jackson.core.async.NonBlockingInputFeeder.

public boolean
canUseCharArrays()

Overrides tools.jackson.core.base.TextualTSFactory.canUseCharArrays.

Introspection method that can be used by base factory to check whether access using char[] is something that actual parser implementations can take advantage of, over having to use java.io.Reader.

public boolean
canUseSchema(FormatSchema schema)

Implements abstract tools.jackson.core.TokenStreamFactory.canUseSchema.

Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use.

public YAMLFactory
copy()

Implements abstract tools.jackson.core.TokenStreamFactory.copy.

Method similar to snapshot(), but one that forces creation of actual new copy that does NOT share any state, even non-visible to calling code, such as symbol table reuse.

public String
getFormatName()

Implements abstract tools.jackson.core.TokenStreamFactory.getFormatName.

Method that returns short textual id identifying format this factory supports.

public int
public Class<YAMLReadFeature>
getFormatReadFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Method for accessing kind of FormatFeature that a parser JsonParser produced by this factory would accept, if any; null returned if none.

public int
public Class<YAMLWriteFeature>
getFormatWriteFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Method for accessing kind of FormatFeature that a parser JsonGenerator produced by this factory would accept, if any; null returned if none.

public boolean
public boolean
protected Object
readResolve()

Method that we need to override to actually make restoration go through constructors etc.

public YAMLFactoryBuilder
rebuild()

Implements abstract tools.jackson.core.TokenStreamFactory.rebuild.

Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.

public TokenStreamFactory
snapshot()

Implements abstract tools.jackson.core.TokenStreamFactory.snapshot.

Implements tools.jackson.core.util.Snapshottable.snapshot.

Instances are immutable so just return `this`

public Version
version()

Implements abstract tools.jackson.core.TokenStreamFactory.version.

Implements tools.jackson.core.Versioned.version.

Method called to detect version of the component that implements this interface; returned version should never be null, but may return specific "not available" instance (see Version for details).

Inherited from tools.jackson.core.base.TextualTSFactory:
_createContentReference_createContentReferencecanHandleBinaryNativelycreateGeneratorcreateGeneratorcreateGeneratorcreateGeneratorcreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParsercreateParser

Field Detail

_dumpSettingsback to summary
protected final DumpSettings _dumpSettings

Configuration for underlying generator to follow, if specified; left as null for backwards compatibility (which means the dumper options are derived based on YAMLWriteFeatures).

These YAMLWriteFeatures are ignored if you provide your own DumperOptions:

  • YAMLGenerator.Feature.ALLOW_LONG_KEYS
  • YAMLGenerator.Feature.CANONICAL_OUTPUT
  • YAMLGenerator.Feature.INDENT_ARRAYS
  • YAMLGenerator.Feature.INDENT_ARRAYS_WITH_INDICATOR
  • YAMLGenerator.Feature.SPLIT_LINES
  • YAMLGenerator.Feature.USE_PLATFORM_LINE_BREAKS

_loadSettingsback to summary
protected final LoadSettings _loadSettings

Configuration for underlying parser to follow, if specified; left as null for backwards compatibility (which means whatever default settings snakeyaml-engine deems best).

_quotingCheckerback to summary
protected final StringQuotingChecker _quotingChecker

Helper object used to determine whether property names, String values must be quoted or not.

_versionback to summary
protected final SpecVersion _version

YAML version for underlying generator to follow, if specified.

DEFAULT_YAML_GENERATOR_FEATURE_FLAGSback to summary
protected static final int DEFAULT_YAML_GENERATOR_FEATURE_FLAGS

Bitfield (set of flags) of all generator features that are enabled by default.

DEFAULT_YAML_PARSER_FEATURE_FLAGSback to summary
protected static final int DEFAULT_YAML_PARSER_FEATURE_FLAGS

Bitfield (set of flags) of all generator features that are enabled by default.

FORMAT_NAME_YAMLback to summary
public static final String FORMAT_NAME_YAML

Name used to identify YAML format. (and returned by getFormatName()

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.core.base.TextualTSFactory.serialVersionUID.

Constructor Detail

YAMLFactoryback to summary
public YAMLFactory()

Default constructor used to create factory instances that may be used to construct an instance with default settings, instead of using YAMLFactoryBuilder.

YAMLFactoryback to summary
public YAMLFactory(YAMLFactory src)
YAMLFactoryback to summary
protected YAMLFactory(YAMLFactoryBuilder b)

Constructors used by YAMLFactoryBuilder for instantiation.

Since
3.0

Method Detail

_createGeneratorback to summary
protected YAMLGenerator _createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, Writer out)

Implements abstract tools.jackson.core.base.TextualTSFactory._createGenerator.

Doc from tools.jackson.core.base.TextualTSFactory._createGenerator.

Overridable factory method that actually instantiates generator for given Writer and context object.

This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

Annotations
@Override
_createParserback to summary
protected YAMLParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, InputStream in)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

Annotations
@Override
_createParserback to summary
protected YAMLParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, Reader r)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

Annotations
@Override
_createParserback to summary
protected YAMLParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, char[] data, int offset, int len, boolean recyclable)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

Annotations
@Override
_createParserback to summary
protected YAMLParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

Annotations
@Override
_createParserback to summary
protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, DataInput input)

Implements abstract tools.jackson.core.base.TextualTSFactory._createParser.

Annotations
@Override
_createReaderback to summary
protected Reader _createReader(InputStream in, JsonEncoding enc, IOContext ctxt)
_createReaderback to summary
protected Reader _createReader(byte[] data, int offset, int len, JsonEncoding enc, IOContext ctxt)
_createUTF8Generatorback to summary
protected YAMLGenerator _createUTF8Generator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out)

Implements abstract tools.jackson.core.base.TextualTSFactory._createUTF8Generator.

Doc from tools.jackson.core.base.TextualTSFactory._createUTF8Generator.

Overridable factory method that actually instantiates generator for given OutputStream and context object, using UTF-8 encoding.

This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.

Annotations
@Override
_createWriterback to summary
protected Writer _createWriter(IOContext ioCtxt, OutputStream out, JsonEncoding enc)

Overrides tools.jackson.core.base.TextualTSFactory._createWriter.

Annotations
@Override
builderback to summary
public static YAMLFactoryBuilder builder()

Main factory method to use for constructing YAMLFactory instances with different configuration.

canParseAsyncback to summary
public boolean canParseAsync()

Implements abstract tools.jackson.core.TokenStreamFactory.canParseAsync.

Doc from tools.jackson.core.TokenStreamFactory.canParseAsync.

Introspection method that can be used to check whether this factory can create non-blocking parsers: parsers that do not use blocking I/O abstractions but instead use a tools.jackson.core.async.NonBlockingInputFeeder.

Annotations
@Override
canUseCharArraysback to summary
public boolean canUseCharArrays()

Overrides tools.jackson.core.base.TextualTSFactory.canUseCharArrays.

Doc from tools.jackson.core.base.TextualTSFactory.canUseCharArrays.

Introspection method that can be used by base factory to check whether access using char[] is something that actual parser implementations can take advantage of, over having to use java.io.Reader. Sub-types are expected to override definition; default implementation (suitable for JSON) alleges that optimization are possible; and thereby is likely to try to access java.lang.String content by first copying it into recyclable intermediate buffer.

Default implementation simply returns true

Annotations
@Override
canUseSchemaback to summary
public boolean canUseSchema(FormatSchema schema)

Implements abstract tools.jackson.core.TokenStreamFactory.canUseSchema.

Doc from tools.jackson.core.TokenStreamFactory.canUseSchema.

Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use. Note that this means possible use, at the level of data format (i.e. schema is for same data format as parsers and generators this factory constructs); individual schema instances may have further usage restrictions.

Annotations
@Override
copyback to summary
public YAMLFactory copy()

Implements abstract tools.jackson.core.TokenStreamFactory.copy.

Doc from tools.jackson.core.TokenStreamFactory.copy.

Method similar to snapshot(), but one that forces creation of actual new copy that does NOT share any state, even non-visible to calling code, such as symbol table reuse.

Implementation should be functionally equivalent to:

    factoryInstance.rebuild().build();
Annotations
@Override
getFormatNameback to summary
public String getFormatName()

Implements abstract tools.jackson.core.TokenStreamFactory.getFormatName.

Doc from tools.jackson.core.TokenStreamFactory.getFormatName.

Method that returns short textual id identifying format this factory supports.

Annotations
@Override
getFormatReadFeaturesback to summary
public int getFormatReadFeatures()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatures.

Annotations
@Override
getFormatReadFeatureTypeback to summary
public Class<YAMLReadFeature> getFormatReadFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Doc from tools.jackson.core.TokenStreamFactory.getFormatReadFeatureType.

Method for accessing kind of FormatFeature that a parser JsonParser produced by this factory would accept, if any; null returned if none.

Annotations
@Override
getFormatWriteFeaturesback to summary
public int getFormatWriteFeatures()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatures.

Annotations
@Override
getFormatWriteFeatureTypeback to summary
public Class<YAMLWriteFeature> getFormatWriteFeatureType()

Overrides tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Doc from tools.jackson.core.TokenStreamFactory.getFormatWriteFeatureType.

Method for accessing kind of FormatFeature that a parser JsonGenerator produced by this factory would accept, if any; null returned if none.

Annotations
@Override
isEnabledback to summary
public boolean isEnabled(YAMLReadFeature f)
isEnabledback to summary
public boolean isEnabled(YAMLWriteFeature f)
readResolveback to summary
protected Object readResolve()

Method that we need to override to actually make restoration go through constructors etc.

rebuildback to summary
public YAMLFactoryBuilder rebuild()

Implements abstract tools.jackson.core.TokenStreamFactory.rebuild.

Doc from tools.jackson.core.TokenStreamFactory.rebuild.

Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.

Annotations
@Override
snapshotback to summary
public TokenStreamFactory snapshot()

Implements abstract tools.jackson.core.TokenStreamFactory.snapshot.

Implements tools.jackson.core.util.Snapshottable.snapshot.

Instances are immutable so just return `this`

Annotations
@Override
versionback to summary
public Version version()

Implements abstract tools.jackson.core.TokenStreamFactory.version.

Implements tools.jackson.core.Versioned.version.

Doc from tools.jackson.core.Versioned.version.

Method called to detect version of the component that implements this interface; returned version should never be null, but may return specific "not available" instance (see Version for details).

Annotations
@Override