Class AbstractScope

Object
gudusoft.gsqlparser.resolver2.scope.AbstractScope
All Implemented Interfaces:
IScope
Direct Known Subclasses:
DeleteScope, GlobalScope, GroupByScope, HavingScope, ListBasedScope, MergeScope, OraclePackageScope, OrderByScope, PlsqlBlockScope, SelectScope, UpdateScope

public abstract class AbstractScope extends Object implements IScope
Abstract base class for all scopes. Implements delegation pattern - most methods delegate to parent. Subclasses only need to override methods where they have special behavior.
  • Field Details

  • Constructor Details

  • Method Details

    • getParent

      public IScope getParent()
      Description copied from interface: IScope
      Get the parent scope. Root scope (GlobalScope) has EmptyScope as parent.
      Specified by:
      getParent in interface IScope
      Returns:
      Parent scope, never null
    • getNode

      Description copied from interface: IScope
      Get the associated AST node
      Specified by:
      getNode in interface IScope
      Returns:
      AST node for this scope
    • getScopeType

      Description copied from interface: IScope
      Get the scope type
      Specified by:
      getScopeType in interface IScope
      Returns:
      Scope type enum
    • resolve

      public void resolve(List<String> names, INameMatcher matcher, boolean deep, IResolved resolved)
      Default implementation: delegate to parent
      Specified by:
      resolve in interface IScope
      Parameters:
      names - Name parts (e.g., ["schema", "table", "column"])
      matcher - Name matcher for case sensitivity rules
      deep - Whether to recursively resolve into record fields
      resolved - Callback to collect all matches
    • resolveTable

      public INamespace resolveTable(String tableName)
      Default implementation: delegate to parent
      Specified by:
      resolveTable in interface IScope
      Parameters:
      tableName - Table name or alias
      Returns:
      Namespace if found, null otherwise
    • addChild

      public void addChild(INamespace namespace, String alias, boolean nullable)
      Default implementation: not supported (most scopes don't have children)
      Specified by:
      addChild in interface IScope
      Parameters:
      namespace - The namespace to add
      alias - The alias for this namespace
      nullable - Whether this namespace is nullable (e.g., RIGHT side of LEFT JOIN)
    • getChildren

      Default implementation: empty list
      Specified by:
      getChildren in interface IScope
      Returns:
      List of scope children
    • getVisibleNamespaces

      Default implementation: delegate to parent
      Specified by:
      getVisibleNamespaces in interface IScope
      Returns:
      List of visible namespaces
    • fullyQualify

      Default implementation: delegate to parent
      Specified by:
      fullyQualify in interface IScope
      Parameters:
      name - Name to qualify
      Returns:
      Qualified name
    • isWithin

      public boolean isWithin(IScope ancestorScope)
      Default implementation: check ancestry
      Specified by:
      isWithin in interface IScope
      Parameters:
      ancestorScope - Potential ancestor scope
      Returns:
      true if this scope is nested within ancestorScope
    • toString

      public String toString()
      Overrides:
      toString in class Object