public final class FieldDeclaration extends BodyDeclaration<FieldDeclaration> implements NodeWithJavaDoc<FieldDeclaration>, NodeWithType<FieldDeclaration>, NodeWithModifiers<FieldDeclaration>
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE
Constructor and Description |
---|
FieldDeclaration() |
FieldDeclaration(EnumSet<Modifier> modifiers,
List<AnnotationExpr> annotations,
Type type,
List<VariableDeclarator> variables) |
FieldDeclaration(EnumSet<Modifier> modifiers,
Type type,
List<VariableDeclarator> variables) |
FieldDeclaration(EnumSet<Modifier> modifiers,
Type type,
VariableDeclarator variable) |
FieldDeclaration(Range range,
EnumSet<Modifier> modifiers,
List<AnnotationExpr> annotations,
Type type,
List<VariableDeclarator> variables) |
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
|
JavadocComment |
getJavaDoc()
Gets the JavaDoc for this node.
|
EnumSet<Modifier> |
getModifiers()
Return the modifiers of this member declaration.
|
Type |
getType()
Gets the type
|
List<VariableDeclarator> |
getVariables() |
FieldDeclaration |
setModifiers(EnumSet<Modifier> modifiers) |
FieldDeclaration |
setType(Type type)
Sets the type
|
void |
setVariables(List<VariableDeclarator> variables) |
getAnnotations, setAnnotations
addOrphanComment, clone, contains, equals, getAllContainedComments, getBegin, getChildrenNodes, getComment, getData, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeOfType, getRange, hasComment, hashCode, isPositionedAfter, isPositionedBefore, setAsParentNodeOf, setAsParentNodeOf, setBegin, setBlockComment, setComment, setData, setEnd, setLineComment, setParentNode, setRange, toString, toStringWithoutComments, tryAddImportToParentCompilationUnit
finalize, getClass, notify, notifyAll, wait, wait, wait
setJavaDocComment
setType
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 type, VariableDeclarator variable)
public FieldDeclaration(EnumSet<Modifier> modifiers, Type type, List<VariableDeclarator> variables)
public FieldDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables)
public FieldDeclaration(Range range, EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables)
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 Type getType()
NodeWithType
getType
in interface NodeWithType<FieldDeclaration>
public List<VariableDeclarator> getVariables()
public FieldDeclaration setModifiers(EnumSet<Modifier> modifiers)
setModifiers
in interface NodeWithModifiers<FieldDeclaration>
public FieldDeclaration setType(Type type)
NodeWithType
setType
in interface NodeWithType<FieldDeclaration>
type
- the typepublic void setVariables(List<VariableDeclarator> variables)
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 enumCopyright © 2007–2016. All rights reserved.