Package com.google.gerrit.server
Enum OutputFormat
- java.lang.Object
-
- java.lang.Enum<OutputFormat>
-
- com.google.gerrit.server.OutputFormat
-
- All Implemented Interfaces:
Serializable
,Comparable<OutputFormat>
public enum OutputFormat extends Enum<OutputFormat>
Standard output format used by an API call.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description JSON
Pretty-printed JSON format.JSON_COMPACT
Same asJSON
, but with unnecessary whitespace removed to save generation time and copy costs.TEXT
The output is a human readable text format.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isJson()
com.google.gson.Gson
newGson()
com.google.gson.GsonBuilder
newGsonBuilder()
static OutputFormat
valueOf(String name)
Returns the enum constant of this type with the specified name.static OutputFormat[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
TEXT
public static final OutputFormat TEXT
The output is a human readable text format. It may also be regular enough to be machine readable. Whether or not the text format is machine readable and will be committed to as a long term format that tools can build upon is specific to each API call.
-
JSON
public static final OutputFormat JSON
Pretty-printed JSON format. This format uses whitespace to make the output readable by a human, but is also machine readable with a JSON library. The structure of the output is a long term format that tools can rely upon.
-
JSON_COMPACT
public static final OutputFormat JSON_COMPACT
Same asJSON
, but with unnecessary whitespace removed to save generation time and copy costs. Typically JSON_COMPACT format is used by a browser based HTML client running over the network.
-
-
Method Detail
-
values
public static 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 (OutputFormat c : 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 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
-
isJson
public boolean isJson()
- Returns:
- true when the format is either JSON or JSON_COMPACT.
-
newGsonBuilder
public com.google.gson.GsonBuilder newGsonBuilder()
- Returns:
- a new Gson instance configured according to the format.
-
newGson
public com.google.gson.Gson newGson()
- Returns:
- a new Gson instance configured according to the format.
-
-