Enum Class JsonGenerator.Mode

java.lang.Object
java.lang.Enum<JsonGenerator.Mode>
uk.blankaspect.common.json.JsonGenerator.Mode
All Implemented Interfaces:
Serializable, Comparable<JsonGenerator.Mode>, Constable
Enclosing class:
JsonGenerator

public static enum JsonGenerator.Mode extends Enum<JsonGenerator.Mode>
This is an enumeration of the modes that control the way in which whitespace is written between the tokens of the JSON text.
  • Enum Constant Details

    • DENSE

      public static final JsonGenerator.Mode DENSE
      JSON text is written on a single line with no space between tokens.
    • COMPACT

      public static final JsonGenerator.Mode COMPACT
      JSON text is written on a single line with a space between some tokens.
    • NORMAL

      public static final JsonGenerator.Mode NORMAL
      JSON text may be written on multiple lines with a space between some tokens. Compound values (array and object) are written on a single line in some cases:
      • The opening and closing brackets and elements of an array are written on a single line if they all fit on the line; otherwise, they are split over multiple lines, as necessary.
      • An object is written on a single line if it is empty or contains a single property that fits on the line along with its opening and closing braces; otherwise, its properties and closing brace are each written on a separate line, and its opening brace is written on a separate line if the opening bracket on the same line flag is false.
    • EXPANDED

      public static final JsonGenerator.Mode EXPANDED
      JSON text may be written on multiple lines with a space between some tokens. Compound values (array and object) are written on a single line in some cases:
      • An empty array is written on a single line. The elements and closing bracket of a non-empty array are each written on a separate line, and the opening bracket is written on a separate line if the opening bracket on same line flag is false.
      • An empty object is written on a single line. The properties and closing brace of a non-empty object are each written on a separate line, and the opening brace is written on a separate line if the opening bracket on the same line flag is false.
  • Method Details

    • values

      public static JsonGenerator.Mode[] 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 JsonGenerator.Mode 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