|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The JotVariableDeclaration
interface represents a variable declaration. A variable declaration can be either a declaration of a member field or a declaration of a local variable. Each variable declaration contains one or more variables. For example, the following declaration int x
contains a single variable named x
, while the declaration AbstractButton button1 = new JButton(), button2 = new JRadioButton();
contains two variables, button1
and button2
.
A JotVariableDeclaration
will always contain at least one JotVariable
. If the last variable is removed from the declaration, the declaration is automatically removed from the containing class and marked as invalid. Attempting to modify the invalid declaration will result in a JotException
.
Each variable declaration has an associated type. Each variable is either this type or an array type based on the declaration type. For example, in the declaration int x[];
, the declaration has type int
, while the variable has type int[]
.
JotVariable
, "Section 14.4 of the Java Language Specification"Method Summary | |
JotVariable |
addVariable(JotVariable marker, boolean before, java.lang.String varName) Adds a new variable to this declaration. |
JotVariable |
addVariable(java.lang.String varName) Adds a new variable to the end of this declaration. |
JotFieldDeclaration |
getAsFieldDeclaration() |
JotLocalVariableDeclaration |
getAsLocalVariableDeclaration() |
JotType |
getType() Retrieves the base type of this variable declaration. |
JotVariable[] |
getVariables() Retrieves the variables contained in this declaration. |
void |
removeVariable(JotVariable var) Removes a variable from this declaration. |
void |
setType(java.lang.String newType) Sets the base type of this variable declaration. |
Methods inherited from interface oracle.jdeveloper.jot.JotHasModifiers |
getModifiers, getModifierText, setModifiers, setModifierText |
Methods inherited from interface oracle.jdeveloper.jot.JotCodeElement |
addPrecedingComment, childrenContainErrors, delete, getContainingJotFile, getLeftWhitespace, getLength, getRightWhitespace, isInError, isSource, setLeftWhitespace, setRightWhitespace |
Methods inherited from interface oracle.jdeveloper.jot.JotElement |
getChildren, getContainedElements, getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isReadOnly, isStructureKnown, setParent |
Method Detail |
public JotType getType() throws JotInvalidElementException
JotType
representing this declaration's type.JotInvalidElementException
public void setType(java.lang.String newType) throws JotInvalidElementException, JotException
newType
- the new type for this declaration.JotException
- if this declaration's type cannot be modified.JotInvalidElementException
public JotVariable[] getVariables() throws JotInvalidElementException
JotVariable
s representing this declarations's variables. This declaration will contains at least one variable as long as it is valid.JotInvalidElementException
public JotVariable addVariable(JotVariable marker, boolean before, java.lang.String varName) throws JotInvalidElementException, JotException
marker
- an existing variable in this declaration to position relative to, or null
to position at the beginning or end.before
- whether to position the new variable before or after the existing variable; or, if the marker variable is null
, whether to position the new variable at the beginning or the end of this declaration.varName
- the name of the new variable.JotVariable
representing the new variable.JotException
- if this declaration cannot be modified.JotInvalidElementException
public JotVariable addVariable(java.lang.String varName) throws JotInvalidElementException, JotException
varName
- the name of the new variable.JotVariable
representing the new variable.JotException
- if this declaration cannot be modified.JotInvalidElementException
public void removeVariable(JotVariable var) throws JotInvalidElementException, JotException
JotException
- if the variable cannot be removed from this declaration.JotInvalidElementException
public JotFieldDeclaration getAsFieldDeclaration()
public JotLocalVariableDeclaration getAsLocalVariableDeclaration()
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.