Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.1.0)

E13403-02

oracle.javatools.parser.java.v1.symbol
Class RootSymbol

java.lang.Object
  extended by oracle.javatools.parser.util.ArrayListHeap
      extended by oracle.javatools.parser.java.v1.symbol.JavaSymbol
          extended by oracle.javatools.parser.java.v1.symbol.RootSymbol
All Implemented Interfaces:
JavaSyntaxCodes, Scope

public class RootSymbol
extends JavaSymbol
implements Scope

The RootSymbol represents the root node for a complete Java source file. From the root, you may retrieve the package, the imports, and all top-level classes and interfaces. For .sqlj parses, you may optionally be able to retrieve a string representing the sql context.


Field Summary
 
Fields inherited from interface oracle.javatools.parser.java.v1.symbol.Scope
SCOPE_BLOCK, SCOPE_CATCH, SCOPE_CLASS, SCOPE_MEMBER, SCOPE_METHOD, SCOPE_ROOT, SCOPE_STATEMENT, SCOPE_TRY
 
Fields inherited from interface oracle.javatools.parser.java.v1.JavaSyntaxCodes
SYNTAX_ARGUMENTS, SYNTAX_ARRAY_CREATOR, SYNTAX_ARRAY_INITIALIZER, SYNTAX_ASG_OPERATOR, SYNTAX_BLOCK, SYNTAX_BRACKET_EXPRESSION, SYNTAX_BRACKETS_OPT, SYNTAX_BROKEN, SYNTAX_CATCH_CLAUSE, SYNTAX_CATCH_PAREN_EXPRESSION, SYNTAX_CLASS_CREATOR, SYNTAX_CLASS_DECLARATION, SYNTAX_CLASS_INITIALIZER, SYNTAX_CODE_ELEMENT, SYNTAX_CONSTRUCTOR_DECLARATION, SYNTAX_CONTROL_PAREN_EXPRESSION, SYNTAX_CREATOR, SYNTAX_DO_STATEMENT, SYNTAX_DOC_COMMENT, SYNTAX_ELSE_CLAUSE, SYNTAX_EXP_WRAPPER, SYNTAX_EXPRESSION, SYNTAX_EXPRESSION_OR_DECL, SYNTAX_EXTENDS, SYNTAX_FIELD_DECLARATION, SYNTAX_FINALLY_CLAUSE, SYNTAX_FOR_CONDITIONAL, SYNTAX_FOR_INIT, SYNTAX_FOR_PAREN_EXPRESSION, SYNTAX_FOR_STATEMENT, SYNTAX_FOR_UPDATE, SYNTAX_FORMAL_PARAMETER, SYNTAX_FORMAL_PARAMETER_LIST, SYNTAX_IDENTIFIER_PRIMARY, SYNTAX_IF_STATEMENT, SYNTAX_IMPLEMENTS, SYNTAX_IMPORT_DECLARATION, SYNTAX_INFIX_OPERATOR, SYNTAX_INIT_ARRAY_CREATOR, SYNTAX_INNER_CLASS_OR_INTERFACE, SYNTAX_INNER_CREATOR, SYNTAX_INTERFACE_DECLARATION, SYNTAX_JAVA_ROOT, SYNTAX_MEMBER_DECLARATION, SYNTAX_METHOD_DECLARATION, SYNTAX_MODIFIERS, SYNTAX_PACKAGE_DECLARATION, SYNTAX_PAREN_EXPRESSION, SYNTAX_POSTFIX_OPERATOR, SYNTAX_PREFIX_OPERATOR, SYNTAX_PRIMARY, SYNTAX_PRIMARY_BRACKETS, SYNTAX_PRIMARY_WORD, SYNTAX_QUALIFIED_IMPORT_NAME, SYNTAX_QUALIFIED_NAME, SYNTAX_QUALIFIED_PRIMARY, SYNTAX_QUES_OPERATOR, SYNTAX_SIMPLE_NAME, SYNTAX_SQLJ_CONTEXT, SYNTAX_SQLJ_STATEMENT, SYNTAX_STATEMENT, SYNTAX_SWITCH_BLOCK, SYNTAX_SWITCH_CASE, SYNTAX_SWITCH_STATEMENT, SYNTAX_SYNCH_STATEMENT, SYNTAX_THROWS, SYNTAX_TRY_STATEMENT, SYNTAX_TYPE, SYNTAX_TYPE_BODY, SYNTAX_TYPE_DECLARATION, SYNTAX_UNINIT_ARRAY_CREATOR, SYNTAX_UNPARSED_BLOCK, SYNTAX_UNPARSED_EXPRESSION, SYNTAX_UNPARSED_PAREN_EXPRESSION, SYNTAX_VARIABLE_DECLARATOR, SYNTAX_VARIABLE_INITIALIZER, SYNTAX_WHILE_STATEMENT
 
Method Summary
 boolean findLabel(java.lang.String name)
          Note that only STATEMENT scopes may return true for findLabel.
 ClassSymbol findType(java.lang.String name)
          If this scope contains local classes or declared member inner classes, check to see if one exists that matches the given name.
 VariableSymbol findVariable(java.lang.String name)
          If this scope contains local variables, method parameters, or declared member fields, check to see if one exists that matches the given name.
 CatchClause[] getCatchClauses()
           
 ClassSymbol[] getClasses()
           
 Scope getEnclosingScope()
          Retrieves the most tightly enclosing scope object.
 ErrorSymbol[] getErrors()
           
 ImportSymbol[] getImports()
           
 NameSymbol[] getLabels()
           
 int getModifiers()
          If this is a ClassSymbol or a MemberSymbol, return the modifiers.
 PackageSymbol getPackage()
           
 int getScopeType()
          Returns the type of this scope according to the enumeration.
 NameSymbol getSqlContext()
           
 VariableSymbol[] getVariables()
           
 boolean hasErrors()
           
 void setEnclosingScope(Scope scope)
          Sets the enclosing scope to the given Scope object.
 void setErrorArray(ErrorSymbol[] errorArray)
           
 
Methods inherited from class oracle.javatools.parser.java.v1.symbol.JavaSymbol
getCode, getEndOffset, getParent, getStartOffset
 
Methods inherited from class oracle.javatools.parser.util.ArrayListHeap
allocArrayList, freeArrayList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPackage

public PackageSymbol getPackage()
Returns:
The package symbol. Null if none.

getImports

public ImportSymbol[] getImports()
Returns:
The array of import symbols.

getClasses

public ClassSymbol[] getClasses()
Specified by:
getClasses in interface Scope
Returns:
The array of class symbols.

getSqlContext

public NameSymbol getSqlContext()
Returns:
a JavaSymbol for the sql context. Null if none.

hasErrors

public boolean hasErrors()
Returns:
True if parsing generated any errors. False otherwise.

getErrors

public ErrorSymbol[] getErrors()
Returns:
The array of error symbols.

setErrorArray

public final void setErrorArray(ErrorSymbol[] errorArray)

getScopeType

public int getScopeType()
Returns the type of this scope according to the enumeration. Yes, this is kind of redundant, but it's much faster than an if-else instanceof test.

Specified by:
getScopeType in interface Scope

getEnclosingScope

public Scope getEnclosingScope()
Retrieves the most tightly enclosing scope object.

Specified by:
getEnclosingScope in interface Scope

setEnclosingScope

public void setEnclosingScope(Scope scope)
Sets the enclosing scope to the given Scope object.

Specified by:
setEnclosingScope in interface Scope

getModifiers

public int getModifiers()
If this is a ClassSymbol or a MemberSymbol, return the modifiers. Else return zero.

Specified by:
getModifiers in interface Scope

findLabel

public boolean findLabel(java.lang.String name)
Description copied from interface: Scope
Note that only STATEMENT scopes may return true for findLabel. Memory-efficient operation.

Specified by:
findLabel in interface Scope
Returns:
True if the given label applies to this scope instance.

findVariable

public VariableSymbol findVariable(java.lang.String name)
If this scope contains local variables, method parameters, or declared member fields, check to see if one exists that matches the given name. If yes, return it. Return null, otherwise.

Specified by:
findVariable in interface Scope

findType

public ClassSymbol findType(java.lang.String name)
If this scope contains local classes or declared member inner classes, check to see if one exists that matches the given name. If yes, return it. Return null otherwise.

Specified by:
findType in interface Scope

getLabels

public NameSymbol[] getLabels()
Specified by:
getLabels in interface Scope
Returns:
Retrieves all labels. Only STATEMENT scopes should a non-zero length array here.

getVariables

public VariableSymbol[] getVariables()
Specified by:
getVariables in interface Scope
Returns:
Retrieves all variables at this scope.

getCatchClauses

public CatchClause[] getCatchClauses()
Specified by:
getCatchClauses in interface Scope
Returns:
Retrieves all catch clauses. Only TRY scopes should return a non-zero length array here.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.1.0)

E13403-02

Copyright © 1997, 2009, Oracle. All rights reserved.