Enum JSONStringer.Scope

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

    static enum JSONStringer.Scope
    extends java.lang.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 Summary

      Enum Constants 
      Enum Constant Description
      DANGLING_KEY
      An object whose most recent element is a key.
      EMPTY_ARRAY
      An array with no elements requires no separators or newlines before it is closed.
      EMPTY_OBJECT
      An object with no keys or values requires no separators or newlines before it is closed.
      NONEMPTY_ARRAY
      A array with at least one value requires a comma and newline before the next element.
      NONEMPTY_OBJECT
      An object with at least one name/value pair requires a comma and newline before the next element.
      NULL
      A special bracketless array needed by JSONStringer.join() and JSONObject.quote() only.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Scope()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static JSONStringer.Scope valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static JSONStringer.Scope[] 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

      • 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 Detail

      • Scope

        private Scope()
    • Method Detail

      • values

        public static JSONStringer.Scope[] 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 (JSONStringer.Scope c : JSONStringer.Scope.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

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