public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> implements NodeWithJavaDoc<FieldDeclaration>, NodeWithElementType<FieldDeclaration>, NodeWithModifiers<FieldDeclaration>, NodeWithVariables<FieldDeclaration>
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE
Constructor and Description |
---|
FieldDeclaration() |
FieldDeclaration(EnumSet<Modifier> modifiers,
List<AnnotationExpr> annotations,
Type elementType,
List<ArrayBracketPair> arrayBracketPairsAfterElementType,
List<VariableDeclarator> variables) |
FieldDeclaration(EnumSet<Modifier> modifiers,
Type elementType,
List<VariableDeclarator> variables) |
FieldDeclaration(EnumSet<Modifier> modifiers,
Type elementType,
VariableDeclarator variable) |
FieldDeclaration(Range range,
EnumSet<Modifier> modifiers,
List<AnnotationExpr> annotations,
Type elementType,
List<VariableDeclarator> variables,
List<ArrayBracketPair> arrayBracketPairsAfterElementType) |
Modifier and Type | Method and Description |
---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
static FieldDeclaration |
create(EnumSet<Modifier> modifiers,
Type type,
String name)
Creates a
FieldDeclaration . |
static FieldDeclaration |
create(EnumSet<Modifier> modifiers,
Type type,
VariableDeclarator variable)
Creates a
FieldDeclaration . |
MethodDeclaration |
createGetter()
Create a getter for this field, will only work if this field declares only 1 identifier and if this field is
already added to a ClassOrInterfaceDeclaration
|
MethodDeclaration |
createSetter()
Create a setter for this field, will only work if this field declares only 1 identifier and if this field is
already added to a ClassOrInterfaceDeclaration
|
List<ArrayBracketPair> |
getArrayBracketPairsAfterElementType() |
Type |
getElementType() |
JavadocComment |
getJavaDoc()
Gets the JavaDoc for this node.
|
EnumSet<Modifier> |
getModifiers()
Return the modifiers of this member declaration.
|
List<VariableDeclarator> |
getVariables() |
FieldDeclaration |
setArrayBracketPairsAfterElementType(List<ArrayBracketPair> arrayBracketPairsAfterType) |
FieldDeclaration |
setElementType(Type elementType) |
FieldDeclaration |
setModifiers(EnumSet<Modifier> modifiers) |
FieldDeclaration |
setVariables(List<VariableDeclarator> variables) |
getAnnotations, setAnnotations
addOrphanComment, clone, contains, equals, getAllContainedComments, getBegin, getChildrenNodes, getComment, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeOfType, getRange, getUserData, hasComment, hashCode, isPositionedAfter, isPositionedBefore, setAsParentNodeOf, setAsParentNodeOf, setBegin, setBlockComment, setComment, setEnd, setLineComment, setParentNode, setRange, setUserData, toString, toStringWithoutComments, tryAddImportToParentCompilationUnit
finalize, getClass, notify, notifyAll, wait, wait, wait
setJavaDocComment
setElementType, setElementType
addModifier, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile
addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent
public FieldDeclaration()
public FieldDeclaration(EnumSet<Modifier> modifiers, Type elementType, VariableDeclarator variable)
public FieldDeclaration(EnumSet<Modifier> modifiers, Type elementType, List<VariableDeclarator> variables)
public FieldDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, Type elementType, List<ArrayBracketPair> arrayBracketPairsAfterElementType, List<VariableDeclarator> variables)
public FieldDeclaration(Range range, EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, Type elementType, List<VariableDeclarator> variables, List<ArrayBracketPair> arrayBracketPairsAfterElementType)
public static FieldDeclaration create(EnumSet<Modifier> modifiers, Type type, VariableDeclarator variable)
FieldDeclaration
.modifiers
- modifierstype
- typevariable
- variable declaratorFieldDeclaration
public static FieldDeclaration create(EnumSet<Modifier> modifiers, Type type, String name)
FieldDeclaration
.modifiers
- modifierstype
- typename
- field nameFieldDeclaration
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Node
public <A> void accept(VoidVisitor<A> v, A arg)
Node
public EnumSet<Modifier> getModifiers()
getModifiers
in interface NodeWithModifiers<FieldDeclaration>
Modifier
public List<VariableDeclarator> getVariables()
getVariables
in interface NodeWithVariables<FieldDeclaration>
public FieldDeclaration setModifiers(EnumSet<Modifier> modifiers)
setModifiers
in interface NodeWithModifiers<FieldDeclaration>
public FieldDeclaration setVariables(List<VariableDeclarator> variables)
setVariables
in interface NodeWithVariables<FieldDeclaration>
public JavadocComment getJavaDoc()
NodeWithJavaDoc
getJavaDoc
in interface NodeWithJavaDoc<FieldDeclaration>
public MethodDeclaration createGetter()
MethodDeclaration
createdIllegalStateException
- if there is more than 1 variable identifier or if this field isn't attached to a
class or enumpublic MethodDeclaration createSetter()
MethodDeclaration
createdIllegalStateException
- if there is more than 1 variable identifier or if this field isn't attached to a
class or enumpublic Type getElementType()
getElementType
in interface NodeWithElementType<FieldDeclaration>
public FieldDeclaration setElementType(Type elementType)
setElementType
in interface NodeWithElementType<FieldDeclaration>
elementType
- the element elementTypepublic List<ArrayBracketPair> getArrayBracketPairsAfterElementType()
getArrayBracketPairsAfterElementType
in interface NodeWithElementType<FieldDeclaration>
class C { int[] abc; }
public FieldDeclaration setArrayBracketPairsAfterElementType(List<ArrayBracketPair> arrayBracketPairsAfterType)
setArrayBracketPairsAfterElementType
in interface NodeWithElementType<FieldDeclaration>
Copyright © 2007–2016. All rights reserved.