Enum Class YAMLWriteFeature

java.lang.Object
java.lang.Enum<YAMLWriteFeature>
tools.jackson.dataformat.yaml.YAMLWriteFeature
All Implemented Interfaces:
Serializable, Comparable<YAMLWriteFeature>, Constable, tools.jackson.core.FormatFeature, tools.jackson.core.util.JacksonFeature

public enum YAMLWriteFeature extends Enum<YAMLWriteFeature> implements tools.jackson.core.FormatFeature
Enumeration that defines all togglable features for YAML generators

NOTE: in Jackson 2.x this was named YAMLGenerator.Feature.

  • Enum Constant Details

    • WRITE_DOC_START_MARKER

      public static final YAMLWriteFeature WRITE_DOC_START_MARKER
      Whether we are to write an explicit document start marker ("---") or not.
    • USE_NATIVE_OBJECT_ID

      public static final YAMLWriteFeature USE_NATIVE_OBJECT_ID
      Whether to use YAML native Object Id construct for indicating type (true); or "generic" Object Id mechanism (false). Former works better for systems that are YAML-centric; latter may be better choice for interoperability, when converting between formats or accepting other formats.
    • USE_NATIVE_TYPE_ID

      public static final YAMLWriteFeature USE_NATIVE_TYPE_ID
      Whether to use YAML native Type Id construct for indicating type (true); or "generic" type property (false). Former works better for systems that are YAML-centric; latter may be better choice for interoperability, when converting between formats or accepting other formats.
    • CANONICAL_OUTPUT

      public static final YAMLWriteFeature CANONICAL_OUTPUT
      Do we try to force so-called canonical output or not.

      Ignored if you provide your own DumperOptions.

    • SPLIT_LINES

      public static final YAMLWriteFeature SPLIT_LINES
      Options passed to SnakeYAML that determines whether longer textual content gets automatically split into multiple lines or not.

      Feature is enabled by default to conform to SnakeYAML defaults.

      Ignored if you provide your own DumperOptions.

    • MINIMIZE_QUOTES

      public static final YAMLWriteFeature MINIMIZE_QUOTES
      Whether strings will be rendered without quotes (true) or with quotes (false, default).

      Minimized quote usage makes for more human readable output; however, content is limited to printable characters according to the rules of literal block style.

    • ALWAYS_QUOTE_NUMBERS_AS_STRINGS

      public static final YAMLWriteFeature ALWAYS_QUOTE_NUMBERS_AS_STRINGS
      Whether numbers stored as strings will be rendered with quotes (true) or without quotes (false, default) when MINIMIZE_QUOTES is enabled.

      Minimized quote usage makes for more human readable output; however, content is limited to printable characters according to the rules of literal block style.

    • LITERAL_BLOCK_STYLE

      public static final YAMLWriteFeature LITERAL_BLOCK_STYLE
      Whether for string containing newlines a literal block style should be used. This automatically enabled when MINIMIZE_QUOTES is set.

      The content of such strings is limited to printable characters according to the rules of literal block style.

    • INDENT_ARRAYS

      public static final YAMLWriteFeature INDENT_ARRAYS
      Feature enabling of which adds indentation for array entry generation (default indentation being 2 spaces).

      Default value is false for backwards compatibility

      Ignored if you provide your own DumperOptions.

    • INDENT_ARRAYS_WITH_INDICATOR

      public static final YAMLWriteFeature INDENT_ARRAYS_WITH_INDICATOR
      Feature enabling of which adds indentation with indicator for array entry generation (default indentation being 2 spaces).

      Default value is false for backwards compatibility

      Ignored if you provide your own DumperOptions.

    • ALLOW_LONG_KEYS

      public static final YAMLWriteFeature ALLOW_LONG_KEYS
      Option passed to SnakeYAML to allows writing key longer that 128 characters (up to 1024 characters). If disabled, the max key length is left as 128 characters: longer names are truncated. If enabled, limit is raised to 1024 characters.

      Ignored if you provide your own DumperOptions.

  • Method Details

    • values

      public static YAMLWriteFeature[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static YAMLWriteFeature valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • collectDefaults

      public static int collectDefaults()
      Method that calculates bit set (flags) of all features that are enabled by default.
    • enabledByDefault

      public boolean enabledByDefault()
      Specified by:
      enabledByDefault in interface tools.jackson.core.util.JacksonFeature
    • enabledIn

      public boolean enabledIn(int flags)
      Specified by:
      enabledIn in interface tools.jackson.core.util.JacksonFeature
    • getMask

      public int getMask()
      Specified by:
      getMask in interface tools.jackson.core.util.JacksonFeature