public abstract class VariableDeclaration extends JavaDeclaration implements TypeReferenceContainer
Modifier and Type | Field and Description |
---|---|
protected boolean |
parentIsInterfaceDeclaration
this field stores if parent is an InterfaceDeclaration because we will be
unable to walk the tree upwards to check this
|
protected TypeReference |
typeReference
Type reference.
|
modArray
Constructor and Description |
---|
VariableDeclaration()
Variable declaration.
|
VariableDeclaration(ExtList children,
boolean parentIsInterfaceDeclaration)
Variable declaration.
|
VariableDeclaration(ImmutableArray<Modifier> mods,
TypeReference typeRef,
boolean parentIsInterfaceDeclaration)
Variable declaration.
|
VariableDeclaration(Modifier[] mods,
TypeReference typeRef,
boolean parentIsInterfaceDeclaration)
Variable declaration.
|
Modifier and Type | Method and Description |
---|---|
SourceElement |
getFirstElement()
Finds the source element that occurs first in the source.
|
SourceElement |
getFirstElementIncludingBlocks()
Finds the source element that occurs first in the source.
|
SourceElement |
getLastElement()
Finds the source element that occurs last in the source.
|
TypeReference |
getTypeReference()
Get type reference.
|
TypeReference |
getTypeReferenceAt(int index) |
int |
getTypeReferenceCount()
Get the number of type references in this container.
|
abstract ImmutableArray<? extends VariableSpecification> |
getVariables()
Get variables.
|
boolean |
isFinal()
Test whether the declaration is final.
|
boolean |
parentIsInterfaceDeclaration()
this field stores if parent is an InterfaceDeclaration because we will be
unable to walk the tree upwards to check this
|
void |
prettyPrint(PrettyPrinter p)
Pretty printing the source element.
|
void |
visit(Visitor v)
calls the corresponding method of a visitor in order to
perform some action/transformation on this element
|
getModifiers, getStateCount, getVisibilityModifier, isAbstract, isGhost, isModel, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictFp, isSynchronized, isTransient, isVolatile
compatibleBlockSize, computeHashCode, equals, equalsModRenaming, getArrayPos, match, matchChildren
getComments, hashCode, prettyPrintMain, reuseSignature
getEndPosition, getParentClass, getPositionInfo, getRelativePosition, getStartPosition, setParentClass, toSource, toString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChildAt, getChildCount
getComments, match
equalsModRenaming, getEndPosition, getPositionInfo, getRelativePosition, getStartPosition
protected final TypeReference typeReference
protected final boolean parentIsInterfaceDeclaration
public VariableDeclaration()
public VariableDeclaration(Modifier[] mods, TypeReference typeRef, boolean parentIsInterfaceDeclaration)
mods
- a modifier mutable list.typeRef
- a type reference.parentIsInterfaceDeclaration
- a boolean set true iff
the parent is an InterfaceDeclarationpublic VariableDeclaration(ImmutableArray<Modifier> mods, TypeReference typeRef, boolean parentIsInterfaceDeclaration)
mods
- a modifier immutable list.typeRef
- a type reference.parentIsInterfaceDeclaration
- a boolean set true iff
the parent is an InterfaceDeclarationpublic VariableDeclaration(ExtList children, boolean parentIsInterfaceDeclaration)
children
- an ExtList of children. May
include:
a TypeReference (as reference to the type of the declared variable)
several Modifier (taken as modifiers of the declaration),
CommentsparentIsInterfaceDeclaration
- a boolean set true iff
the parent is an InterfaceDeclarationpublic SourceElement getFirstElement()
JavaSourceElement
getFirstElement
in interface SourceElement
getFirstElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getStartPosition()
public SourceElement getFirstElementIncludingBlocks()
SourceElement
getFirstElementIncludingBlocks
in interface SourceElement
getFirstElementIncludingBlocks
in class JavaSourceElement
SourceElement.getStartPosition()
public SourceElement getLastElement()
JavaSourceElement
getLastElement
in interface SourceElement
getLastElement
in class JavaSourceElement
JavaSourceElement.toSource()
,
JavaSourceElement.getEndPosition()
public int getTypeReferenceCount()
getTypeReferenceCount
in interface TypeReferenceContainer
public TypeReference getTypeReferenceAt(int index)
getTypeReferenceAt
in interface TypeReferenceContainer
public TypeReference getTypeReference()
public abstract ImmutableArray<? extends VariableSpecification> getVariables()
public boolean isFinal()
isFinal
in class JavaDeclaration
public boolean parentIsInterfaceDeclaration()
public void visit(Visitor v)
visit
in interface SourceElement
v
- the Visitorpublic void prettyPrint(PrettyPrinter p) throws java.io.IOException
JavaSourceElement
prettyPrint
in interface SourceElement
prettyPrint
in class JavaProgramElement
p
- a pretty printer.java.io.IOException
- occasionally thrown.