Enum YAMLGenerator.Feature

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<YAMLGenerator.Feature>
    Enclosing class:
    YAMLGenerator

    public static enum YAMLGenerator.Feature
    extends java.lang.Enum<YAMLGenerator.Feature>
    Enumeration that defines all togglable features for YAML generators
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      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.
      CANONICAL_OUTPUT
      Do we try to force so-called canonical output or not.
      MINIMIZE_QUOTES
      Whether strings will be rendered without quotes (true) or with quotes (false, default).
      SPLIT_LINES
      Options passed to SnakeYAML that determines whether longer textual content gets automatically split into multiple lines or not.
      USE_NATIVE_OBJECT_ID
      Whether to use YAML native Object Id construct for indicating type (true); or "generic" Object Id mechanism (false).
      USE_NATIVE_TYPE_ID
      Whether to use YAML native Type Id construct for indicating type (true); or "generic" type property (false).
      WRITE_DOC_START_MARKER
      Whether we are to write an explicit document start marker ("---") or not.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean _defaultState  
      protected int _mask  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int collectDefaults()
      Method that calculates bit set (flags) of all features that are enabled by default.
      boolean enabledByDefault()  
      boolean enabledIn​(int flags)  
      int getMask()  
      static YAMLGenerator.Feature valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static YAMLGenerator.Feature[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • WRITE_DOC_START_MARKER

        public static final YAMLGenerator.Feature WRITE_DOC_START_MARKER
        Whether we are to write an explicit document start marker ("---") or not.
        Since:
        2.3
      • USE_NATIVE_OBJECT_ID

        public static final YAMLGenerator.Feature 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.
        Since:
        2.5
      • USE_NATIVE_TYPE_ID

        public static final YAMLGenerator.Feature 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.
        Since:
        2.5
      • CANONICAL_OUTPUT

        public static final YAMLGenerator.Feature CANONICAL_OUTPUT
        Do we try to force so-called canonical output or not.
      • SPLIT_LINES

        public static final YAMLGenerator.Feature 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 as well as backwards compatibility with 2.5 and earlier versions.

        Since:
        2.6
      • MINIMIZE_QUOTES

        public static final YAMLGenerator.Feature 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.

        Since:
        2.7
      • ALWAYS_QUOTE_NUMBERS_AS_STRINGS

        public static final YAMLGenerator.Feature 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.

        Since:
        2.8.2
    • Field Detail

      • _defaultState

        protected final boolean _defaultState
      • _mask

        protected final int _mask
    • Method Detail

      • values

        public static YAMLGenerator.Feature[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (YAMLGenerator.Feature c : YAMLGenerator.Feature.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static YAMLGenerator.Feature valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.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()
      • enabledIn

        public boolean enabledIn​(int flags)
      • getMask

        public int getMask()