Package com.github.tnakamot.json.value
Class JSONValueBoolean
- java.lang.Object
 - 
- com.github.tnakamot.json.value.JSONValue
 - 
- com.github.tnakamot.json.value.JSONValuePrimitive
 - 
- com.github.tnakamot.json.value.JSONValueBoolean
 
 
 
 
- 
public class JSONValueBoolean extends JSONValuePrimitive
Represents one JSON 'boolean' value.Instances of this class are immutable.
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static JSONValueBooleanFALSEstatic JSONValueBooleanTRUE 
- 
Constructor Summary
Constructors Constructor Description JSONValueBoolean(JSONTokenBoolean token)Create an instance of a Java representation of a JSON boolean value from a JSON boolean token. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)inthashCode()StringtoString()@NotNull StringtoTokenString()Convert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network.@NotNull StringtoTokenString(String newline, String indent)Convert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network.booleanvalue()Return the value represented by Java boolean primitives of this JSON boolean value.static JSONValueBooleanvalueOf(boolean value)Convert Java boolean primitive to a JSON boolean value- 
Methods inherited from class com.github.tnakamot.json.value.JSONValuePrimitive
token 
- 
Methods inherited from class com.github.tnakamot.json.value.JSONValue
toTokenBytes, toTokenBytes, type 
 - 
 
 - 
 
- 
- 
Field Detail
- 
TRUE
public static final JSONValueBoolean TRUE
 
- 
FALSE
public static final JSONValueBoolean FALSE
 
 - 
 
- 
Constructor Detail
- 
JSONValueBoolean
public JSONValueBoolean(JSONTokenBoolean token)
Create an instance of a Java representation of a JSON boolean value from a JSON boolean token.- Parameters:
 token- source token of this JSON boolean value.
 
 - 
 
- 
Method Detail
- 
valueOf
public static JSONValueBoolean valueOf(boolean value)
Convert Java boolean primitive to a JSON boolean value- Parameters:
 value- value Java boolean primitive to convert- Returns:
 - converted JSON boolean value
 
 
- 
value
public boolean value()
Return the value represented by Java boolean primitives of this JSON boolean value.- Returns:
 - value represented by Java boolean primitives of this JSON boolean value
 
 
- 
toTokenString
@NotNull public @NotNull String toTokenString()
Description copied from class:JSONValueConvert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network. The output text is optimized for machine, so no indent or new lines will be inserted.Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned
Stringto a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
 toTokenStringin classJSONValue- Returns:
 - a string representation of this JSON value
 
 
- 
toTokenString
@NotNull public @NotNull String toTokenString(String newline, String indent)
Description copied from class:JSONValueConvert this JSON value toStringwhich can be saved as a JSON text to a file or transmitted to network. The output text is optimized for human. Indents and new line characters are inserted accordingly.Note that, according to RFC 8259 - 8.1 Character Encoding, your application program must encode the returned String using UTF-8 without BOM before writing the returned
Stringto a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
 toTokenStringin classJSONValue- Parameters:
 newline- line separator; "\r", "\n" or "\r\n"indent- indent string. Must consist of " " and "\t".- Returns:
 - a string representation of this JSON value
 
 
 - 
 
 -