Enum Class JsonHelper.OutputFormat

java.lang.Object
java.lang.Enum<JsonHelper.OutputFormat>
org.kiwiproject.json.JsonHelper.OutputFormat
All Implemented Interfaces:
Serializable, Comparable<JsonHelper.OutputFormat>, Constable
Enclosing class:
JsonHelper

public static enum JsonHelper.OutputFormat extends Enum<JsonHelper.OutputFormat>
Represents an output format when serializing an object to JSON.
  • Enum Constant Details

  • Method Details

    • values

      public static JsonHelper.OutputFormat[] 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 JsonHelper.OutputFormat 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
    • ofPrettyValue

      public static JsonHelper.OutputFormat ofPrettyValue(String pretty)
      Parse the given string as a boolean into an JsonHelper.OutputFormat. Uses Boolean.parseBoolean(String).
      Parameters:
      pretty - the boolean value as a string
      Returns:
      the format
    • ofPrettyValue

      public static JsonHelper.OutputFormat ofPrettyValue(@Nullable Boolean pretty)
      Parse the (nullable) Boolean value into an JsonHelper.OutputFormat. A null is treated as false.
      Parameters:
      pretty - the nullable value
      Returns:
      the format
    • ofPrettyValue

      public static JsonHelper.OutputFormat ofPrettyValue(boolean pretty)
      Convert the given boolean value to the appropriate JsonHelper.OutputFormat.
      Parameters:
      pretty - true or false
      Returns:
      PRETTY if the argument is true; otherwise DEFAULT