Interface SymbolToken

All Known Subinterfaces:
_Private_SymbolToken

public interface SymbolToken
An Ion symbol token (field name, annotation, and symbol values) providing both the symbol text and the assigned symbol ID. Symbol tokens may be interned into a SymbolTable.

Any instance will have at least one of the two properties defined.

WARNING: This interface should not be implemented or extended by code outside of this library.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SymbolToken[]
    A zero-length array.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the text of this symbol, throwing an exception if its unknown.
    int
    Gets the ID of this symbol token.
    Gets the text of this symbol.
  • Field Details

    • EMPTY_ARRAY

      static final SymbolToken[] EMPTY_ARRAY
      A zero-length array.
  • Method Details

    • getText

      String getText()
      Gets the text of this symbol.

      If the text is not known (usually due to a shared symbol table being unavailable) then this method returns null. In such cases getSid() will be non-negative.

      Returns:
      the text of this symbol, or null if the text is unknown.
    • assumeText

      String assumeText()
      Gets the text of this symbol, throwing an exception if its unknown.
      Returns:
      the text of the symbol, not null.
      Throws:
      UnknownSymbolException - if the symbol text isn't known.
    • getSid

      int getSid()
      Gets the ID of this symbol token.

      If no ID has yet been assigned (as may be the case when processing Ion text-formatted data), this method returns SymbolTable.UNKNOWN_SYMBOL_ID. In such cases getText() will be non-null.

      Returns:
      the symbol ID (sid) of this symbol, or SymbolTable.UNKNOWN_SYMBOL_ID if the sid is unknown.