Package uk.blankaspect.common.json
Enum Class JsonGenerator.Mode
- All Implemented Interfaces:
Serializable
,Comparable<JsonGenerator.Mode>
,Constable
- Enclosing class:
- JsonGenerator
This is an enumeration of the modes that control the way in which whitespace is written between the tokens of the
JSON text.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionJSON text is written on a single line with a space between some tokens.JSON text is written on a single line with no space between tokens.JSON text may be written on multiple lines with a space between some tokens.JSON text may be written on multiple lines with a space between some tokens. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonGenerator.Mode
Returns the enum constant of this class with the specified name.static JsonGenerator.Mode[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DENSE
JSON text is written on a single line with no space between tokens. -
COMPACT
JSON text is written on a single line with a space between some tokens. -
NORMAL
JSON text may be written on multiple lines with a space between some tokens. Compound values (array and object) are written on a single line in some cases:- The opening and closing brackets and elements of an array are written on a single line if they all fit on the line; otherwise, they are split over multiple lines, as necessary.
- An object is written on a single line if it is empty or contains a single property that fits on the
line along with its opening and closing braces; otherwise, its properties and closing brace are each
written on a separate line, and its opening brace is written on a separate line if the opening
bracket on the same line flag is
false
.
-
EXPANDED
JSON text may be written on multiple lines with a space between some tokens. Compound values (array and object) are written on a single line in some cases:- An empty array is written on a single line. The elements and closing bracket of a non-empty array are
each written on a separate line, and the opening bracket is written on a separate line if the
opening bracket on same line flag is
false
. - An empty object is written on a single line. The properties and closing brace of a non-empty object
are each written on a separate line, and the opening brace is written on a separate line if the
opening bracket on the same line flag is
false
.
- An empty array is written on a single line. The elements and closing bracket of a non-empty array are
each written on a separate line, and the opening bracket is written on a separate line if the
opening bracket on same line flag is
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-