Enum JsonFormat.Shape

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

    public static enum JsonFormat.Shape
    extends java.lang.Enum<JsonFormat.Shape>
    Value enumeration used for indicating preferred Shape; translates loosely to JSON types, with some extra values to indicate less precise choices (i.e. allowing one of multiple actual shapes)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ANY
      Marker enum value that indicates "whatever" choice, meaning that annotation does NOT specify shape to use.
      ARRAY
      Value that indicates that (JSON) Array type should be used.
      BINARY
      Value that indicates that Binary type (native, if format supports it; encoding using Base64 if only textual types supported) should be used.
      BOOLEAN
      Value that indicates that (JSON) boolean type (true, false) should be used.
      NATURAL
      Marker enum value that indicates the "default" choice for given datatype; for example, JSON String for String, or JSON Number for Java numbers.
      NUMBER
      Value that indicates that a numeric (JSON) type should be used (but does not specify whether integer or floating-point representation should be used)
      NUMBER_FLOAT
      Value that indicates that floating-point numeric type should be used
      NUMBER_INT
      Value that indicates that integer number type should be used (and not NUMBER_FLOAT).
      OBJECT
      Value that indicates that (JSON) Object type should be used.
      SCALAR
      Value that indicates shape should not be structural (that is, not ARRAY or OBJECT, but can be any other shape.
      STRING
      Value that indicates that (JSON) String type should be used.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isNumeric()  
      boolean isStructured()  
      static JsonFormat.Shape valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static JsonFormat.Shape[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

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

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

      • ANY

        public static final JsonFormat.Shape ANY
        Marker enum value that indicates "whatever" choice, meaning that annotation does NOT specify shape to use. Note that this is different from NATURAL, which specifically instructs use of the "natural" shape for datatype.
      • NATURAL

        public static final JsonFormat.Shape NATURAL
        Marker enum value that indicates the "default" choice for given datatype; for example, JSON String for String, or JSON Number for Java numbers. Note that this is different from ANY in that this is actual explicit choice that overrides possible default settings.
        Since:
        2.8
      • SCALAR

        public static final JsonFormat.Shape SCALAR
        Value that indicates shape should not be structural (that is, not ARRAY or OBJECT, but can be any other shape.
      • ARRAY

        public static final JsonFormat.Shape ARRAY
        Value that indicates that (JSON) Array type should be used.
      • OBJECT

        public static final JsonFormat.Shape OBJECT
        Value that indicates that (JSON) Object type should be used.
      • NUMBER

        public static final JsonFormat.Shape NUMBER
        Value that indicates that a numeric (JSON) type should be used (but does not specify whether integer or floating-point representation should be used)
      • NUMBER_FLOAT

        public static final JsonFormat.Shape NUMBER_FLOAT
        Value that indicates that floating-point numeric type should be used
      • NUMBER_INT

        public static final JsonFormat.Shape NUMBER_INT
        Value that indicates that integer number type should be used (and not NUMBER_FLOAT).
      • STRING

        public static final JsonFormat.Shape STRING
        Value that indicates that (JSON) String type should be used.
      • BOOLEAN

        public static final JsonFormat.Shape BOOLEAN
        Value that indicates that (JSON) boolean type (true, false) should be used.
      • BINARY

        public static final JsonFormat.Shape BINARY
        Value that indicates that Binary type (native, if format supports it; encoding using Base64 if only textual types supported) should be used.
        Since:
        2.10
    • Method Detail

      • values

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

        public static JsonFormat.Shape 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
      • isNumeric

        public boolean isNumeric()
      • isStructured

        public boolean isStructured()