Package groovy.json

Class JsonToken

java.lang.Object
groovy.json.JsonToken

public class JsonToken extends Object
A JSON token, with a type, line / column information, and the text of that token.
Since:
1.8.0
  • Constructor Details

    • JsonToken

      public JsonToken()
  • Method Details

    • getValue

      public Object getValue()
      Return the value represented by this token (i.e. a number, a string, a boolean or null). For numbers, BigDecimal is returned for decimals and Integer, Long or BigInteger for integral numbers.
      Returns:
      the represented value
    • toString

      public String toString()
      Returns a debug string containing the token text, type, and source positions.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this token
    • getStartLine

      public long getStartLine()
      Returns the starting line of this token.
      Returns:
      the starting line number
    • setStartLine

      public void setStartLine(long startLine)
      Sets the starting line of this token.
      Parameters:
      startLine - the starting line number
    • getEndLine

      public long getEndLine()
      Returns the ending line of this token.
      Returns:
      the ending line number
    • setEndLine

      public void setEndLine(long endLine)
      Sets the ending line of this token.
      Parameters:
      endLine - the ending line number
    • getStartColumn

      public long getStartColumn()
      Returns the starting column of this token.
      Returns:
      the starting column number
    • setStartColumn

      public void setStartColumn(long startColumn)
      Sets the starting column of this token.
      Parameters:
      startColumn - the starting column number
    • getEndColumn

      public long getEndColumn()
      Returns the ending column of this token.
      Returns:
      the ending column number
    • setEndColumn

      public void setEndColumn(long endColumn)
      Sets the ending column of this token.
      Parameters:
      endColumn - the ending column number
    • getType

      public JsonTokenType getType()
      Returns the token type.
      Returns:
      the token type
    • setType

      public void setType(JsonTokenType type)
      Sets the token type.
      Parameters:
      type - the token type
    • setText

      public void setText(String text)
      Sets the token text.
      Parameters:
      text - the token text
    • getText

      public String getText()
      Returns the token text.
      Returns:
      the token text