Package ghidra.program.model.symbol

# Class SymbolType

java.lang.Object
ghidra.program.model.symbol.SymbolType

public abstract class SymbolType extends Object
Class to represent the various types of Symbols.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final SymbolType`
  `CLASS`
  `static final SymbolType`
  `CODE`
  Deprecated, for removal: This API element is subject to removal in a future version.
  use `LABEL` instead.
  `static final SymbolType`
  `FUNCTION`
  `static final SymbolType`
  `GLOBAL`
  `static final SymbolType`
  `GLOBAL_VAR`
  `static final SymbolType`
  `LABEL`
  `static final SymbolType`
  `LIBRARY`
  `static final SymbolType`
  `LOCAL_VAR`
  `static final SymbolType`
  `NAMESPACE`
  `static final SymbolType`
  `PARAMETER`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `allowsDuplicates()`
  Returns true of this symbol type allows duplicate names.
  `boolean`
  `equals(Object obj)`
  `byte`
  `getID()`
  Returns the id of this symbol type.
  `static SymbolType`
  `getSymbolType(int id)`
  Returns the SymbolType for the given id.
  `int`
  `hashCode()`
  `boolean`
  `isNamespace()`
  Returns true if this symbol represents a namespace.
  `abstract boolean`
  `isValidAddress(Program program, Address symbolAddress)`
  Returns true if the given address is valid for this symbol type.
  `abstract boolean`
  `isValidParent(Program program, Namespace parent, Address symbolAddr, boolean isExternalSymbol)`
  Returns true if the given namespace is a valid parent for a symbol of this type if it has the given address and whether or not it is external.
  `abstract boolean`
  `isValidSourceType(SourceType sourceType, Address symbolAddress)`
  Returns true if the given SourceType is valid for this symbol type.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### LABEL

    public static final SymbolType LABEL

  - ### CODE

    @Deprecated(since="9.1", forRemoval=true) public static final SymbolType CODE
    Deprecated, for removal: This API element is subject to removal in a future version.
    use `LABEL` instead.

  - ### LIBRARY

    public static final SymbolType LIBRARY

  - ### NAMESPACE

    public static final SymbolType NAMESPACE

  - ### CLASS

    public static final SymbolType CLASS

  - ### FUNCTION

    public static final SymbolType FUNCTION

  - ### PARAMETER

    public static final SymbolType PARAMETER

  - ### LOCAL_VAR

    public static final SymbolType LOCAL_VAR

  - ### GLOBAL_VAR

    public static final SymbolType GLOBAL_VAR

  - ### GLOBAL

    public static final SymbolType GLOBAL

- ## Method Details

  - ### isValidParent

    public abstract boolean isValidParent(Program program, Namespace parent, Address symbolAddr, boolean isExternalSymbol)
    Returns true if the given namespace is a valid parent for a symbol of this type if it has the given address and whether or not it is external.
    Parameters:
      `program` - the program to contain the symbol
      `parent` - the namespace where a symbol will potentially be parented.
      `symbolAddr` - the address of they symbol to be parented.
      `isExternalSymbol` - true if the symbol is external.
    Returns:
      true if the given namespace is a valid parent for a symbol if it has the given address and whether or not it is external.

  - ### isValidAddress

    public abstract boolean isValidAddress(Program program, Address symbolAddress)
    Returns true if the given address is valid for this symbol type.
    Parameters:
      `program` - the program to test for a valid address.
      `symbolAddress` - the address of the symbol to be tested.
    Returns:
      true if the given address is valid within the given program.

  - ### isValidSourceType

    public abstract boolean isValidSourceType(SourceType sourceType, Address symbolAddress)
    Returns true if the given SourceType is valid for this symbol type. (For example, Some symbols don't support the SymbolType.DEFAULT)
    Parameters:
      `sourceType` - the sourceType to test.
      `symbolAddress` - the address of the symbol to be tested.
    Returns:
      true if the given SourceType is valid for this symbol type.

  - ### allowsDuplicates

    public boolean allowsDuplicates()
    Returns true of this symbol type allows duplicate names.
    Returns:
      true of this symbol type allows duplicate names.

  - ### isNamespace

    public boolean isNamespace()
    Returns true if this symbol represents a namespace.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getID

    public byte getID()
    Returns the id of this symbol type.

  - ### getSymbolType

    public static SymbolType getSymbolType(int id)
    Returns the SymbolType for the given id.
    Parameters:
      `id` - the id for the SymbolType to find.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`