Package com.github.tnakamot.json.value
Class JSONValueNull
- java.lang.Object
-
- com.github.tnakamot.json.value.JSONValue
-
- com.github.tnakamot.json.value.JSONValuePrimitive
-
- com.github.tnakamot.json.value.JSONValueNull
-
public class JSONValueNull extends JSONValuePrimitive
Represents one JSON 'null' value.Instances of this class are immutable.
-
-
Field Summary
Fields Modifier and Type Field Description static JSONValueNull
INSTANCE
An instance of null value without token information.
-
Constructor Summary
Constructors Constructor Description JSONValueNull(JSONToken token)
Create an instance of a Java representation of a JSON null value with source JSON text information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
hashCode()
String
toString()
@NotNull String
toTokenString()
Convert this JSON value toString
which can be saved as a JSON text to a file or transmitted to network.@NotNull String
toTokenString(String newline, String indent)
Convert this JSON value toString
which can be saved as a JSON text to a file or transmitted to network.-
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
-
INSTANCE
public static final JSONValueNull INSTANCE
An instance of null value without token information.
-
-
Constructor Detail
-
JSONValueNull
public JSONValueNull(JSONToken token)
Create an instance of a Java representation of a JSON null value with source JSON text information.- Parameters:
token
- source of this JSON null value. Can be null if this JSON null value is not originated from an exiting JSON text.
-
-
Method Detail
-
toTokenString
@NotNull public @NotNull String toTokenString()
Description copied from class:JSONValue
Convert this JSON value toString
which 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
String
to a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
toTokenString
in classJSONValue
- Returns:
- a string representation of this JSON value
-
toTokenString
@NotNull public @NotNull String toTokenString(String newline, String indent)
Description copied from class:JSONValue
Convert this JSON value toString
which 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
String
to a file or a network stream, or network datagram(s). It is caller's responsibility to correctly encode it.- Specified by:
toTokenString
in 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
-
-