public interface SourceVariable extends SourceElement, SourceHasModifiers, SourceHasName, SourceHasType, JavaVariable
| Modifier and Type | Field and Description |
|---|---|
static SourceVariable[] |
EMPTY_ARRAY |
static int |
PRINT_DECLARATION
Constant that can be used as the format argument in calls to
SourceVariable.print(int) or SourceVariable.print(PrintWriter, int).
|
static int |
PRINT_FIELD_NAME
Constant that can be used as the format argument in calls to
SourceVariable.print(int) or SourceVariable.print(PrintWriter, int).
|
static int |
PRINT_TYPE
Constant that can be used as the format argument in calls to
SourceVariable.print(int) or SourceVariable.print(PrintWriter, int).
|
CHILDREN_ALL, CHILDREN_BLANKLINES, CHILDREN_COMMENTS, CHILDREN_default, CHILDREN_none, CHILDREN_REGULAR, PRINT_ALL, REFORMAT_ALL, REFORMAT_INDENT| Modifier and Type | Method and Description |
|---|---|
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.
|
addModifiers, getModifiers, getSourceAnnotations, hasSourceAnnotation, isValidModifiers, removeModifiers, setModifiersgetName, getNameElement, setName, setNameElementgetSourceType, setSourceTypeaddSelf, addSelf, addSelfAfter, addSelfBefore, adjustTextIndentation, clearBinding, cloneSelf, compile, createContext, getBinding, getChildren, getChildren, getCompiledObject, getContainedElements, getContext, getEndOffset, getFirstToken, getJdkVersion, getLastToken, getOwningFile, getOwningSourceFile, getParent, getSiblingAfter, getSiblingAfter, getSiblingBefore, getSiblingBefore, getSiblings, getSiblings, getStartOffset, getSymbolKind, getText, getTokens, getTokens, hasErrors, print, print, print, print, reformatSelf, removeSelf, replaceSelf, resolve, setBinding, setContext, visitSelfgetConstantValue, isVarargsgetResolvedType, getUnresolvedTypegetNamegetAnnotation, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations, hasAnnotation, hasDeclaredAnnotationgetElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfostatic final SourceVariable[] EMPTY_ARRAY
static final int PRINT_FIELD_NAME
static final int PRINT_DECLARATION
static final int PRINT_TYPE
SourceExpression getInitializer()
void setInitializer(SourceExpression expr)
java.lang.IllegalStateException - if the input element is already linked.SourceVariableDeclaration getOwningDeclaration()
Field variables (SRC_FIELD_VARIABLE) return SrcFieldDeclaration's. Formal parameters (SRC_FORMAL_PARAMETER) return null. Local variables (SRC_LOCAL_VARIABLE) return SrcLocalsDeclaration's.
void separateSelf()
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;