Class JsonGeneratorImpl

All Implemented Interfaces:
Versioned, Closeable, Flushable, AutoCloseable
Direct Known Subclasses:
UTF8JsonGenerator, WriterBasedJsonGenerator

public abstract class JsonGeneratorImpl extends GeneratorBase
Intermediate base class shared by JSON-backed generators like UTF8JsonGenerator and WriterBasedJsonGenerator.
Since:
2.1
  • Constructor Details

  • Method Details

    • version

      public Version version()
      Description copied from class: GeneratorBase
      Implemented with standard version number detection algorithm, typically using a simple generated class, with information extracted from Maven project file during build.
      Specified by:
      version in interface Versioned
      Overrides:
      version in class GeneratorBase
      Returns:
      Version number of the generator (version of the jar that contains generator implementation class)
    • streamWriteConstraints

      public StreamWriteConstraints streamWriteConstraints()
      Description copied from class: JsonGenerator
      Get the constraints to apply when performing streaming writes.
      Overrides:
      streamWriteConstraints in class JsonGenerator
    • enable

      Description copied from class: JsonGenerator
      Method for enabling specified generator feature: check JsonGenerator.Feature for list of available features.
      Overrides:
      enable in class GeneratorBase
      Parameters:
      f - Feature to enable
      Returns:
      This generator, to allow call chaining
    • disable

      Description copied from class: JsonGenerator
      Method for disabling specified feature (check JsonGenerator.Feature for list of features)
      Overrides:
      disable in class GeneratorBase
      Parameters:
      f - Feature to disable
      Returns:
      This generator, to allow call chaining
    • setHighestNonEscapedChar

      public JsonGenerator setHighestNonEscapedChar(int charCode)
      Description copied from class: JsonGenerator
      Method that can be called to request that generator escapes all character codes above specified code point (if positive value); or, to not escape any characters except for ones that must be escaped for the data format (if -1). To force escaping of all non-ASCII characters, for example, this method would be called with value of 127.

      Note that generators are NOT required to support setting of value higher than 127, because there are other ways to affect quoting (or lack thereof) of character codes between 0 and 127. Not all generators support concept of escaping, either; if so, calling this method will have no effect.

      Default implementation does nothing; sub-classes need to redefine it according to rules of supported data format.

      Overrides:
      setHighestNonEscapedChar in class JsonGenerator
      Parameters:
      charCode - Either -1 to indicate that no additional escaping is to be done; or highest code point not to escape (meaning higher ones will be), if positive value.
      Returns:
      This generator, to allow call chaining
    • getHighestEscapedChar

      public int getHighestEscapedChar()
      Description copied from class: JsonGenerator
      Accessor method for testing what is the highest unescaped character configured for this generator. This may be either positive value (when escaping configuration has been set and is in effect), or 0 to indicate that no additional escaping is in effect. Some generators may not support additional escaping: for example, generators for binary formats that do not use escaping should simply return 0.
      Overrides:
      getHighestEscapedChar in class JsonGenerator
      Returns:
      Currently active limitation for highest non-escaped character, if defined; or 0 to indicate no additional escaping is performed.
    • setCharacterEscapes

      public JsonGenerator setCharacterEscapes(CharacterEscapes esc)
      Description copied from class: JsonGenerator
      Method for defining custom escapes factory uses for JsonGenerators it creates.

      Default implementation does nothing and simply returns this instance.

      Overrides:
      setCharacterEscapes in class JsonGenerator
      Parameters:
      esc - CharacterEscapes to configure this generator to use, if any; null if none
      Returns:
      This generator, to allow call chaining
    • getCharacterEscapes

      public CharacterEscapes getCharacterEscapes()
      Method for accessing custom escapes factory uses for JsonGenerators it creates.
      Overrides:
      getCharacterEscapes in class JsonGenerator
      Returns:
      CharacterEscapes configured for this generator, if any; null if none
    • setRootValueSeparator

      public JsonGenerator setRootValueSeparator(SerializableString sep)
      Description copied from class: JsonGenerator
      Method that allows overriding String used for separating root-level JSON values (default is single space character)

      Default implementation throws UnsupportedOperationException.

      Overrides:
      setRootValueSeparator in class JsonGenerator
      Parameters:
      sep - Separator to use, if any; null means that no separator is automatically added
      Returns:
      This generator, to allow call chaining
    • getWriteCapabilities

      public JacksonFeatureSet<StreamWriteCapability> getWriteCapabilities()
      Description copied from class: JsonGenerator
      Accessor for getting metadata on capabilities of this generator, based on underlying data format being read (directly or indirectly).
      Overrides:
      getWriteCapabilities in class JsonGenerator
      Returns:
      Set of write capabilities for content written using this generator