Enum JsonType

java.lang.Object
java.lang.Enum<JsonType>
org.apache.juneau.dto.jsonschema.JsonType
All Implemented Interfaces:
Serializable, Comparable<JsonType>, java.lang.constant.Constable

public enum JsonType extends Enum<JsonType>
Represents possible JSON types in the JSON-Schema core specification.

Implements custom toString() and fromString(String) methods that override the default serialization/parsing behavior of Enum types so that they are represented in lowercase form (as per the specification).

Example:

// Produces 'number', not 'NUMBER'. String json = JsonSerializer.DEFAULT.serialize(JsonType.NUMBER);

  • Enum Constant Details

  • Method Details

    • values

      public static JsonType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static JsonType valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • toString

      public String toString()
      Returns the lowercase form of this enum that's compatible with the JSON-Schema specification.
      Overrides:
      toString in class Enum<JsonType>
    • fromString

      public static JsonType fromString(String value)
      Converts the specified lowercase form of the enum back into an Enum.
      Parameters:
      value - The lowercase form of the enum (e.g. "array").
      Returns:
      The matching Enum, or null if no match found.