Package org.kiwiproject.json
Enum JsonHelper.OutputFormat
- java.lang.Object
-
- java.lang.Enum<JsonHelper.OutputFormat>
-
- org.kiwiproject.json.JsonHelper.OutputFormat
-
- All Implemented Interfaces:
Serializable,Comparable<JsonHelper.OutputFormat>
- Enclosing class:
- JsonHelper
public static enum JsonHelper.OutputFormat extends Enum<JsonHelper.OutputFormat>
Represents an output format when serializing an object to JSON.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JsonHelper.OutputFormatofPrettyValue(boolean pretty)Convert the given boolean value to the appropriateJsonHelper.OutputFormat.static JsonHelper.OutputFormatofPrettyValue(Boolean pretty)Parse the (nullable) Boolean value into anJsonHelper.OutputFormat.static JsonHelper.OutputFormatofPrettyValue(String pretty)Parse the given string as a boolean into anJsonHelper.OutputFormat.static JsonHelper.OutputFormatvalueOf(String name)Returns the enum constant of this type with the specified name.static JsonHelper.OutputFormat[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DEFAULT
public static final JsonHelper.OutputFormat DEFAULT
JSON may or may not be formatted (but probably not).
-
PRETTY
public static final JsonHelper.OutputFormat PRETTY
JSON will be formatted nicely.
-
-
Method Detail
-
values
public static JsonHelper.OutputFormat[] 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 (JsonHelper.OutputFormat c : JsonHelper.OutputFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static JsonHelper.OutputFormat 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 nameNullPointerException- if the argument is null
-
ofPrettyValue
public static JsonHelper.OutputFormat ofPrettyValue(String pretty)
Parse the given string as a boolean into anJsonHelper.OutputFormat. UsesBoolean.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 anJsonHelper.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 appropriateJsonHelper.OutputFormat.
-
-