Enum Class JSONStringer.Scope

java.lang.Object
java.lang.Enum<JSONStringer.Scope>
com.github.openjson.JSONStringer.Scope
All Implemented Interfaces:
Serializable, Comparable<JSONStringer.Scope>, Constable
Enclosing class:
JSONStringer

static enum JSONStringer.Scope extends Enum<JSONStringer.Scope>
Lexical scoping elements within this stringer, necessary to insert the appropriate separator characters (ie. commas and colons) and to detect nesting errors.
  • Enum Constant Details

    • EMPTY_ARRAY

      public static final JSONStringer.Scope EMPTY_ARRAY
      An array with no elements requires no separators or newlines before it is closed.
    • NONEMPTY_ARRAY

      public static final JSONStringer.Scope NONEMPTY_ARRAY
      A array with at least one value requires a comma and newline before the next element.
    • EMPTY_OBJECT

      public static final JSONStringer.Scope EMPTY_OBJECT
      An object with no keys or values requires no separators or newlines before it is closed.
    • DANGLING_KEY

      public static final JSONStringer.Scope DANGLING_KEY
      An object whose most recent element is a key. The next element must be a value.
    • NONEMPTY_OBJECT

      public static final JSONStringer.Scope NONEMPTY_OBJECT
      An object with at least one name/value pair requires a comma and newline before the next element.
    • NULL

      public static final JSONStringer.Scope NULL
      A special bracketless array needed by JSONStringer.join() and JSONObject.quote() only. Not used for JSON encoding.
  • Constructor Details

    • Scope

      private Scope()
  • Method Details

    • values

      public static JSONStringer.Scope[] 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 JSONStringer.Scope 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