Package com.github.tnakamot.json.token
Class JSONTokenNumber
- java.lang.Object
-
- com.github.tnakamot.json.token.JSONToken
-
- com.github.tnakamot.json.token.JSONTokenNumber
-
public class JSONTokenNumber extends JSONToken
Represents one "number" type token in JSON text.The representation of a number in JSON is defined by RFC 8259 - 6. Numbers. This RFC specification does not set limits of the range and precision of numbers. Although the specification allows software implementations to set limits, this implementation does not practically set limits. An application program can get the original text that represents this number without loosing precision by calling
text()
to maximize the interoperability.Instances of this class are immutable.
-
-
Field Summary
-
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 JSONTokenNumber(@NotNull String text, @NotNull StringLocation begin, @NotNull StringLocation end, @NotNull JSONText source)
Creates one "number" type token of a JSON text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull String
text()
Text representation of this token as it appears in the source JSON text.-
Methods inherited from class com.github.tnakamot.json.token.JSONToken
beginningLocation, endLocation, range, source, type
-
-
-
-
Constructor Detail
-
JSONTokenNumber
public JSONTokenNumber(@NotNull @NotNull String text, @NotNull @NotNull StringLocation begin, @NotNull @NotNull StringLocation end, @NotNull @NotNull JSONText source)
Creates one "number" type token of a JSON text.It is the caller's responsibility to validate the token text as number 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
-
-
Method Detail
-
text
@NotNull public @NotNull String text()
Text representation of this token as it appears in the source JSON text.The returned text always complies with RFC 8259 - 6. Numbers.
-
-