Interface Symbol

All Known Subinterfaces:
Symbol.MethodSymbol, Symbol.TypeSymbol, Symbol.VariableSymbol
All Known Implementing Classes:
JLabelSymbol, Symbols.DefaultSymbol

public interface Symbol
Interface to access symbol information.
  • Method Details

    • name

      String name()
      Name of this symbol.
      Returns:
      simple name of the symbol.
    • owner

      @Nullable Symbol owner()
      The owner of this symbol.
      Returns:
      the symbol that owns this symbol, null for package symbols, or unknown symbols
    • type

      Type type()
      Type of symbol.
      Returns:
      the type of this symbol.
    • isVariableSymbol

      boolean isVariableSymbol()
    • isTypeSymbol

      boolean isTypeSymbol()
    • isMethodSymbol

      boolean isMethodSymbol()
    • isPackageSymbol

      boolean isPackageSymbol()
    • isStatic

      boolean isStatic()
    • isFinal

      boolean isFinal()
    • isEnum

      boolean isEnum()
    • isInterface

      boolean isInterface()
    • isAbstract

      boolean isAbstract()
    • isPublic

      boolean isPublic()
    • isPrivate

      boolean isPrivate()
    • isProtected

      boolean isProtected()
    • isPackageVisibility

      boolean isPackageVisibility()
    • isDeprecated

      boolean isDeprecated()
    • isVolatile

      boolean isVolatile()
    • isUnknown

      boolean isUnknown()
    • metadata

      SymbolMetadata metadata()
      Symbol metadata informations, annotations for instance.
      Returns:
      the metadata of this symbol.
    • enclosingClass

      @Nullable Symbol.TypeSymbol enclosingClass()
      The closest enclosing class.
      Returns:
      null for package symbols, themselves for type symbol and enclosing class of methods or variables.
    • usages

      List<IdentifierTree> usages()
      The identifier trees that reference this symbol.
      Returns:
      a list of IdentifierTree referencing this symbol. An empty list if this symbol is unused.
    • declaration

      @Nullable Tree declaration()
      Declaration node of this symbol. Currently, only works for declaration within the same file.
      Returns:
      the Tree of the declaration of this symbol. Null if declaration does not occur in the currently analyzed file.