Class 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 by value().

    Instances of this class are immutable.

    • 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 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

      • value

        public boolean value()
        Returns:
        The boolean value of this token represents.