Package com.github.tnakamot.json.token
Class JSONTokenBoolean
- java.lang.Object
-
- com.github.tnakamot.json.token.JSONToken
-
- com.github.tnakamot.json.token.JSONTokenBoolean
-
public class JSONTokenBoolean extends JSONToken
Represents one "boolean" type token in JSON text.Based on RFC 8259, the token text returned by
JSONToken.text()
is either "true" or "false". The representation in Java as a boolean primitive can be obtained byvalue()
.Instances of this class are immutable.
-
-
Field Summary
Fields Modifier and Type Field Description static String
JSON_FALSE
static String
JSON_TRUE
-
Fields inherited from class com.github.tnakamot.json.token.JSONToken
JSON_BEGIN_ARRAY, JSON_BEGIN_OBJECT, JSON_END_ARRAY, JSON_END_OBJECT, JSON_NAME_SEPARATOR, JSON_VALUE_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description JSONTokenBoolean(String text, StringLocation begin, StringLocation end, JSONText source)
Creates one "boolean" type token of a JSON text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
value()
-
Methods inherited from class com.github.tnakamot.json.token.JSONToken
beginningLocation, endLocation, range, source, text, type
-
-
-
-
Field Detail
-
JSON_TRUE
public static final String JSON_TRUE
- See Also:
- Constant Field Values
-
JSON_FALSE
public static final String JSON_FALSE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JSONTokenBoolean
public JSONTokenBoolean(String text, StringLocation begin, StringLocation end, JSONText source)
Creates one "boolean" type token of a JSON text.It is the caller's responsibility to validate the token text as boolean before creating this instance.
- Parameters:
text
- text of this tokenbegin
- beginning location of this token within the source JSON textend
- end location of this token within the source JSON textsource
- source JSON text where this token was extracted from
-
-