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

E13403-04

oracle.javatools.parser.java.v2.model
Interface SourceVariable

All Superinterfaces:
Element, JavaElement, JavaHasAnnotations, JavaHasName, JavaHasType, JavaVariable, SourceElement, SourceHasModifiers, SourceHasName, SourceHasType
All Known Subinterfaces:
SourceEnumConstant, SourceFieldVariable, SourceFormalParameter, SourceLocalVariable, SourceMemberVariable

public interface SourceVariable
extends SourceElement, SourceHasModifiers, SourceHasName, SourceHasType, JavaVariable

A SourceVariable is the syntactic (aka symbolic) representation of a java variable, including: field variables, enum constant variables, local variables, and formal parameters.


Field Summary
static SourceVariable[] EMPTY_ARRAY
           
static int PRINT_DECLARATION
          "type name"
static int PRINT_FIELD_NAME
          "name[]"
static int PRINT_TYPE
          "type"
 
Fields inherited from interface oracle.javatools.parser.java.v2.model.SourceElement
CHILDREN_ALL, CHILDREN_BLANKLINES, CHILDREN_COMMENTS, CHILDREN_default, CHILDREN_none, CHILDREN_REGULAR, PRINT_ALL, REFORMAT_ALL, REFORMAT_INDENT
 
Method Summary
 SourceExpression getInitializer()
          Gets the initializer, null if none.
 SourceVariableDeclaration getOwningDeclaration()
          Gets the owning variable declaration, null if this is a formal parameter.
 void separateSelf()
          Extracts sibling variables so that this is the only variable on its variable declaration.
 void setInitializer(SourceExpression expr)
          Unlinks the current initializer, if any, and links the input element.
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceHasModifiers
addModifiers, getModifiers, getSourceAnnotations, removeModifiers, setModifiers
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceHasName
getName, getNameElement, setName, setNameElement
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceHasType
getSourceType, setSourceType
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceElement
addSelf, addSelf, addSelfAfter, addSelfBefore, clearBinding, cloneSelf, compile, getBinding, getChildren, getChildren, getCompiledObject, getContainedElements, getEndOffset, getOwningFile, getOwningSourceFile, getParent, getSiblingAfter, getSiblingBefore, getSiblings, getSiblings, getStartOffset, getSymbolKind, getText, print, print, reformatSelf, removeSelf, replaceSelf, resolve, setBinding, setContext, visitSelf
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaVariable
getConstantValue, isVarargs
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasType
getResolvedType, getUnresolvedType
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasName
getName
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaHasAnnotations
getAnnotation, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo
 

Field Detail

EMPTY_ARRAY

static final SourceVariable[] EMPTY_ARRAY

PRINT_FIELD_NAME

static final int PRINT_FIELD_NAME
"name[]"

See Also:
Constant Field Values

PRINT_DECLARATION

static final int PRINT_DECLARATION
"type name"

See Also:
Constant Field Values

PRINT_TYPE

static final int PRINT_TYPE
"type"

See Also:
Constant Field Values
Method Detail

getInitializer

SourceExpression getInitializer()
Gets the initializer, null if none.

Returns:
This variable's initializer. Null if none was declared.

setInitializer

void setInitializer(SourceExpression expr)
Unlinks the current initializer, if any, and links the input element.

Throws:
java.lang.IllegalStateException - if the input element is already linked.

getOwningDeclaration

SourceVariableDeclaration getOwningDeclaration()
Gets the owning variable declaration, null if this is a formal parameter.

Returns:
The owning variable declaration.

 Field variables (SRC_FIELD_VARIABLE) return SrcFieldDeclaration's.
 Formal parameters (SRC_FORMAL_PARAMETER) return null.
 Local variables (SRC_LOCAL_VARIABLE) return SrcLocalsDeclaration's.
 

separateSelf

void separateSelf()
Extracts sibling variables so that this is the only variable on its variable declaration. Sibling variables before will be extracted into a new variable declaration that occurs before. Sibling variables after will be extracted into a new variable declaration that occurs after.

For example, suppose we tell "f2" to separate itself:

   int f0 = 0, f1 = 1, f2 = 2, f3 = 3, f4 = 4;
 
Then, the result will be:

   int f0 = 0, f1 = 1;
   int f2 = 2;
   int f3 = 3, f4 = 4;
 


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

E13403-04

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