Extension SDK

oracle.jdeveloper.jot
Interface JotVariable

All Superinterfaces:
JotElement, JotNameable
All Known Subinterfaces:
JotField, JotLocalVariable

public interface JotVariable
extends JotNameable, JotElement

The JotVariable interface represents a variable. A variable could be either a local variable or a member field. Each variable is contained within a variable declaration. A variable declaration may contain more than one variable. For example, the declaration int x, y; contains two variables.
A variable provides read-only access to its modifiers and its type; as these are derived from its owning variable declaration, write access is through the declaration. However, the array dimensions of the variable's type (if any) can be changed directly, although the dimension cannot be reduced below those provided by the declaration. For example, in the declaration int[] x;, the type of x could be changed to int[][] (making the declaration int[] x[];, but not to int.

Since:
5.0
See Also:
JotVariableDeclaration, JotLocalVariable, JotField

Method Summary
 JotField getAsField()
          Retrieves this variable as a field.
 JotLocalVariable getAsLocalVariable()
          Retrieves this variable as a local variable.
 JotExpression getInitializer()
          Retrieves the initialization expression of this variable.
 int getModifiers()
          Retrieves the Java modifiers declared for this variable, encoded as a mask.
 JotVariableDeclaration getOwningDeclaration()
          Retrieves the variable declaration that owns this variable.
 JotType getType()
          Retrieves the type of this variable.
 void setArrayDimensions(int newDims)
          Sets the array dimensions of this variable.
 void setInitializer(java.lang.String init)
          Sets the initialization expression of this variable.
 
Methods inherited from interface oracle.jdeveloper.jot.JotNameable
getName, setName
 
Methods inherited from interface oracle.jdeveloper.jot.JotElement
getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isReadOnly, isStructureKnown, setParent
 

Method Detail

getType

public JotType getType()
Retrieves the type of this variable.

Returns:
the JOT representation of a java type.

getModifiers

public int getModifiers()
Retrieves the Java modifiers declared for this variable, encoded as a mask. The value is encoded using the values specified in java.lang.reflect.Modifier; use the methods provided by Modifier to decode the value (for example, Modifier.isPublic()).

See Also:
Modifier

setArrayDimensions

public void setArrayDimensions(int newDims)
Sets the array dimensions of this variable. These dimensions are in addition to the dimensions provided by the owning declaration.

Parameters:
newDims - the new array dimensions of this variable.

getOwningDeclaration

public JotVariableDeclaration getOwningDeclaration()
Retrieves the variable declaration that owns this variable.

Returns:
the owning variable declaration.

getInitializer

public JotExpression getInitializer()
Retrieves the initialization expression of this variable.

Returns:
a JotExpression representing the intialization expression of this variable.

setInitializer

public void setInitializer(java.lang.String init)
                    throws JotException
Sets the initialization expression of this variable.

Parameters:
init - the new initialization expression.
Throws:
JotException - if the initializer cannot be changed.

getAsField

public JotField getAsField()
Retrieves this variable as a field.

Returns:
this variable as a JotField instance if it represents a field, or null if it does not.

getAsLocalVariable

public JotLocalVariable getAsLocalVariable()
Retrieves this variable as a local variable.

Returns:
this variable as a JotLocalVariable instance if it represents a local variable, or null if it does not.

Extension SDK

 

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