Class JBBPToken

java.lang.Object
com.igormaznitsa.jbbp.compiler.tokenizer.JBBPToken
All Implemented Interfaces:
Serializable

public final class JBBPToken extends Object implements Serializable
The Class describes a token from parsed script.
Since:
1.0
See Also:
  • Method Details

    • getPosition

      public int getPosition()
      Get the token position value in the string
      Returns:
      the position value, the first char is 0. If the value is negative one then the position is undefined.
    • getType

      public JBBPTokenType getType()
      Get the token type.
      Returns:
      get the token type.
      See Also:
    • getFieldName

      public String getFieldName()
      Get the field name of the value represented by the token,
      Returns:
      the field name as string or null if the field doesn't have defined field name.
    • getFieldTypeParameters

      public JBBPFieldTypeParameterContainer getFieldTypeParameters()
      Get the field type parameters.
      Returns:
      the field type parameters
    • isArray

      public boolean isArray()
      Check that the token is array.
      Returns:
      true if the token represents an array, false otherwise
    • isComment

      public boolean isComment()
      Check that the toke is commentaries.
      Returns:
      true if the token represents commentaries, false otherwise
    • isVarArrayLength

      public boolean isVarArrayLength()
      Check that the array is not fixed size one.
      Returns:
      true if the field represents a non-fixed size array
    • getArraySizeAsString

      public String getArraySizeAsString()
      Get the array size value in its raw form.
      Returns:
      the array size value as string, if the field is not an array then null.
    • getArraySizeAsInt

      public Integer getArraySizeAsInt()
      Get numeric representation of the array size.
      Returns:
      the parsed numeric representation of the array size value or null if it can't be parsed
      Throws:
      NullPointerException - will be thrown if the array size value is null
    • toString

      public String toString()
      Overrides:
      toString in class Object