Class 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.

    • 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 token
        begin - beginning location of this token within the source JSON text
        end - end location of this token within the source JSON text
        source - 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.

        Overrides:
        text in class JSONToken
        Returns:
        text representation of this token as it appears in the source JSON text.