public interface SourceVariable extends SourceElement, SourceHasModifiers, SourceHasName, SourceHasType, JavaVariable
Modifier and Type | Field and Description |
---|---|
static SourceVariable[] |
EMPTY_ARRAY |
static int |
PRINT_DECLARATION
"type name"
|
static int |
PRINT_FIELD_NAME
"name[]"
|
static int |
PRINT_TYPE
"type"
|
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, removeModifiers, setModifiers
getName, getNameElement, setName, setNameElement
getSourceType, setSourceType
addSelf, addSelf, addSelfAfter, addSelfBefore, adjustTextIndentation, clearBinding, cloneSelf, compile, getBinding, getChildren, getChildren, getCompiledObject, getContainedElements, getEndOffset, getJdkVersion, getOwningFile, getOwningSourceFile, getParent, getSiblingAfter, getSiblingBefore, getSiblings, getSiblings, getStartOffset, getSymbolKind, getText, getTokens, hasErrors, print, print, reformatSelf, removeSelf, replaceSelf, resolve, setBinding, setContext, visitSelf
getConstantValue, isVarargs
getResolvedType, getUnresolvedType
getName
getAnnotation, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo
static 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()
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;