Class JsonToken

java.lang.Object
de.monticore.symboltable.serialization.JsonToken

public class JsonToken extends Object
This class holds kind and, if present for this kind, also the value of a json token. For tokens without a value, this class has constants that can be used to avoid creating unnecassary objects
  • Field Details

    • BEGIN_OBJECT

      public static final JsonToken BEGIN_OBJECT
    • END_OBJECT

      public static final JsonToken END_OBJECT
    • BEGIN_ARRAY

      public static final JsonToken BEGIN_ARRAY
    • END_ARRAY

      public static final JsonToken END_ARRAY
    • COLON

      public static final JsonToken COLON
    • COMMA

      public static final JsonToken COMMA
    • NULL

      public static final JsonToken NULL
    • WHITESPACE

      public static final JsonToken WHITESPACE
    • BOOLEAN_TRUE

      public static final JsonToken BOOLEAN_TRUE
    • BOOLEAN_FALSE

      public static final JsonToken BOOLEAN_FALSE
    • kind

      protected JsonTokenKind kind
    • value

      protected String value
  • Constructor Details

    • JsonToken

      public JsonToken(JsonTokenKind kind, String value)
      create a token with the passed kind and the passed value
      Parameters:
      kind -
      value -
    • JsonToken

      public JsonToken(JsonTokenKind kind)
      returns a token with the passed kind
      Parameters:
      kind -
  • Method Details

    • getKind

      public JsonTokenKind getKind()
      returns the kind of the token
      Returns:
    • getValue

      public String getValue()
      returns the value of the token if the token kind has a value. Throws an error otherwise
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object