Newer Version Available

This content describes an older version of this product. View Latest

SymbolTable

A complex type that represents all user-defined tokens in the Body of an ApexClass, ApexClassMember, or ApexTriggerMember and their associated line and column locations within the Body.

Fields

Field Details
constructors
Type
array of Constructor
Description
Contains the position, scope, and signature of constructors for the Apex class. Apex triggers don't have constructors.
Constructor includes the following fields:
  • annotations
  • location
  • modifiers
  • name
  • references
  • visibility (available only in API versions 33.0 and earlier; scope: Global, Public, or Private)
  • parameters
externalReferences
Type
array of ExternalReference
Description
Contains the name, namespace, external class, method, and variable references for the Apex class or trigger. These references can be used for symbol highlighting or code navigation.
ExternalReference includes the following fields:
  • methods
  • name
  • namespace
  • references
  • variables
innerClasses
Type
array of SymbolTable
Description
Contains a symbol table for each inner class of the Apex class or trigger.
interfaces
Type
array of String
Description
Contains a set of strings for each interface with the namespace and name, for example: ['System.Batchable', 'MyNamespace.MyInterface'].
methods
Type
array of Method
Description
Contains the position, name, scope, signature, and return type of available Apex methods.
Method includes the following fields:
  • annotations
  • location
  • modifiers
  • name
  • references
  • visibility (available only in API versions 33.0 and earlier; scope: Global, Public, or Private)
  • parameters
  • returnType
name
Type
string
Description
The name of the Apex class or trigger.
namespace
Type
string
Description
The namespace of the Apex class or trigger. Null if there is no namespace.
parentClass
Type
string
Description
Returns parents of inner classes and extending classes.
properties
Type
array of VisibilitySymbol
Description
Contains the position, name, scope, and references of properties for the Apex class or trigger.
VisibilitySymbol includes the following fields:
  • annotations
  • location
  • modifiers
  • name
  • references
  • visibility (available only in API versions 33.0 and earlier; scope: Global, Public, or Private)
tableDeclaration
Type
array of Symbol
Description
Contains the position, name, and references of the Apex class or trigger.
Symbol includes the following fields:
variables
Type
array of Symbol
Description
Contains the position, name, and references of related variables.
Symbol includes the following fields:

Annotations

Available values for annotations fields include:
  • Deprecated
  • Future
  • HttpDelete
  • HttpGet
  • HttpPatch
  • HttpPost
  • HttpPut
  • InvocableMethod
  • InvocableVariable
  • IsTest
  • ReadOnly
  • RemoteAction
  • TestSetup
  • TestVisible
  • RestResource

Modifiers

Modifiers can include more values than those values explicitly specified in classes and methods. All relevant modifiers, including implicit ones, are now returned. For example, all webservice methods have an implicit global modifier. Also, because fields and methods are private unless otherwise specified, the private modifier is returned by default.

The testMethod modifier is returned when either the testMethod modifier or the IsTest annotation is used.

Available values for modifiers fields include:
  • abstract
  • final
  • global
  • inherited sharing
  • override
  • private
  • protected
  • public
  • static
  • testMethod
  • transient
  • virtual
  • webService
  • with sharing
  • without sharing

Usage

Use symbol tables instead of building a parser or compiler. Symbol tables allow you to do symbol highlighting, code navigation, code completion, symbol searches, and more.

A symbol table can’t be created if the content referenced by the ContentEntityId field doesn’t use a symbol table. Compiler errors for the last deployment of the MetadataContainer in the MetadataContainerId field also prevent a symbol table from being created.