public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> implements NodeWithJavaDoc<FieldDeclaration>, NodeWithElementType<FieldDeclaration>, NodeWithModifiers<FieldDeclaration>, NodeWithVariables<FieldDeclaration>
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION
Constructor and Description |
---|
FieldDeclaration() |
FieldDeclaration(EnumSet<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
Type<?> elementType,
NodeList<ArrayBracketPair> arrayBracketPairsAfterElementType,
NodeList<VariableDeclarator> variables) |
FieldDeclaration(EnumSet<Modifier> modifiers,
Type<?> elementType,
NodeList<VariableDeclarator> variables) |
FieldDeclaration(EnumSet<Modifier> modifiers,
Type<?> elementType,
VariableDeclarator variable) |
FieldDeclaration(Range range,
EnumSet<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
Type<?> elementType,
NodeList<VariableDeclarator> variables,
NodeList<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
|
NodeList<ArrayBracketPair> |
getArrayBracketPairsAfterElementType() |
Type |
getElementType() |
Optional<JavadocComment> |
getJavaDoc()
Gets the JavaDoc for this node.
|
EnumSet<Modifier> |
getModifiers()
Return the modifiers of this member declaration.
|
NodeList<VariableDeclarator> |
getVariables() |
FieldDeclaration |
setArrayBracketPairsAfterElementType(NodeList<ArrayBracketPair> arrayBracketPairsAfterType) |
FieldDeclaration |
setElementType(Type elementType) |
FieldDeclaration |
setModifiers(EnumSet<Modifier> modifiers) |
FieldDeclaration |
setVariables(NodeList<VariableDeclarator> variables) |
getAnnotations, setAnnotations
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBackwardsCompatibleChildrenNodes, getBegin, getChildrenNodes, getComment, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeOfType, getRange, getUserData, hashCode, isPositionedAfter, isPositionedBefore, remove, setAsParentNodeOf, 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, NodeList<VariableDeclarator> variables)
public FieldDeclaration(EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, Type<?> elementType, NodeList<ArrayBracketPair> arrayBracketPairsAfterElementType, NodeList<VariableDeclarator> variables)
public FieldDeclaration(Range range, EnumSet<Modifier> modifiers, NodeList<AnnotationExpr> annotations, Type<?> elementType, NodeList<VariableDeclarator> variables, NodeList<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 NodeList<VariableDeclarator> getVariables()
getVariables
in interface NodeWithVariables<FieldDeclaration>
public FieldDeclaration setModifiers(EnumSet<Modifier> modifiers)
setModifiers
in interface NodeWithModifiers<FieldDeclaration>
public FieldDeclaration setVariables(NodeList<VariableDeclarator> variables)
setVariables
in interface NodeWithVariables<FieldDeclaration>
public Optional<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 NodeList<ArrayBracketPair> getArrayBracketPairsAfterElementType()
getArrayBracketPairsAfterElementType
in interface NodeWithElementType<FieldDeclaration>
class C { int[] abc; }
public FieldDeclaration setArrayBracketPairsAfterElementType(NodeList<ArrayBracketPair> arrayBracketPairsAfterType)
setArrayBracketPairsAfterElementType
in interface NodeWithElementType<FieldDeclaration>
Copyright © 2007–2016. All rights reserved.