public class FieldDeclaration extends BodyDeclaration<FieldDeclaration> implements NodeWithJavadoc<FieldDeclaration>, NodeWithVariables<FieldDeclaration>, NodeWithAccessModifiers<FieldDeclaration>, NodeWithStaticModifier<FieldDeclaration>, NodeWithFinalModifier<FieldDeclaration>, Resolvable<ResolvedFieldDeclaration>
class X { private static
int a=15*15; }
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversalABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, LINE_SEPARATOR_KEY, NODE_BY_BEGIN_POSITION, PHANTOM_KEY, prettyPrinterNoCommentsConfiguration, PRINTER_KEY, SYMBOL_RESOLVER_KEY| Constructor and Description |
|---|
FieldDeclaration() |
FieldDeclaration(NodeList<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
NodeList<VariableDeclarator> variables) |
FieldDeclaration(NodeList<Modifier> modifiers,
NodeList<VariableDeclarator> variables) |
FieldDeclaration(NodeList<Modifier> modifiers,
Type type,
String name)
Creates a
FieldDeclaration. |
FieldDeclaration(NodeList<Modifier> modifiers,
VariableDeclarator variable) |
FieldDeclaration(TokenRange tokenRange,
NodeList<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
NodeList<VariableDeclarator> variables)
This constructor is used by the parser and is considered private.
|
| 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.
|
FieldDeclaration |
asFieldDeclaration() |
FieldDeclaration |
clone() |
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
|
FieldDeclarationMetaModel |
getMetaModel() |
NodeList<Modifier> |
getModifiers()
Return the modifiers of this member declaration.
|
NodeList<VariableDeclarator> |
getVariables() |
void |
ifFieldDeclaration(Consumer<FieldDeclaration> action) |
boolean |
isFieldDeclaration() |
boolean |
isFinal() |
boolean |
isPublic() |
boolean |
isStatic() |
boolean |
isTransient() |
boolean |
isVolatile() |
boolean |
remove(Node node) |
boolean |
replace(Node node,
Node replacementNode) |
ResolvedFieldDeclaration |
resolve() |
FieldDeclaration |
setModifiers(NodeList<Modifier> modifiers) |
FieldDeclaration |
setTransient(boolean set) |
FieldDeclaration |
setVariables(NodeList<VariableDeclarator> variables) |
FieldDeclaration |
setVolatile(boolean set) |
Optional<FieldDeclaration> |
toFieldDeclaration() |
asAnnotationDeclaration, asAnnotationMemberDeclaration, asCallableDeclaration, asClassOrInterfaceDeclaration, asCompactConstructorDeclaration, asConstructorDeclaration, asEnumConstantDeclaration, asEnumDeclaration, asInitializerDeclaration, asMethodDeclaration, asRecordDeclaration, asTypeDeclaration, getAnnotations, ifAnnotationDeclaration, ifAnnotationMemberDeclaration, ifCallableDeclaration, ifClassOrInterfaceDeclaration, ifCompactConstructorDeclaration, ifConstructorDeclaration, ifEnumConstantDeclaration, ifEnumDeclaration, ifInitializerDeclaration, ifMethodDeclaration, ifRecordDeclaration, ifTypeDeclaration, isAnnotationDeclaration, isAnnotationMemberDeclaration, isCallableDeclaration, isClassOrInterfaceDeclaration, isCompactConstructorDeclaration, isConstructorDeclaration, isEnumConstantDeclaration, isEnumDeclaration, isInitializerDeclaration, isMethodDeclaration, isRecordDeclaration, isTypeDeclaration, setAnnotations, toAnnotationDeclaration, toAnnotationMemberDeclaration, toCallableDeclaration, toClassOrInterfaceDeclaration, toCompactConstructorDeclaration, toConstructorDeclaration, toEnumConstantDeclaration, toEnumDeclaration, toInitializerDeclaration, toMethodDeclaration, toRecordDeclaration, toTypeDeclarationaddOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findByRange, findCompilationUnit, findData, findFirst, findFirst, findFirst, findRootNode, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getDataKeys, getDefaultPrinterConfiguration, getLineEndingStyle, getLineEndingStyleOrDefault, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getPrinter, getPrinter, getRange, getSymbolResolver, getTokenRange, hashCode, hasScope, isAncestorOf, isPhantom, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeData, removeForced, removeOrphanComment, replace, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, stream, stream, toString, toString, tryAddImportToParentCompilationUnit, unregister, walk, walk, walkfinalize, getClass, notify, notifyAll, wait, wait, waitgetComment, getJavadoc, getJavadocComment, hasJavaDocComment, removeJavaDocComment, setComment, setJavadocComment, setJavadocComment, setJavadocComment, setJavadocCommentaddVariable, calculateMaximumCommonType, getCommonType, getElementType, getMaximumCommonType, getVariable, setAllTypes, setVariablesetPublicisPrivate, setPrivateisProtected, setProtectedaddModifier, getAccessSpecifier, hasModifier, removeModifier, setModifier, setModifierssetStaticsetFinaladdAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnitfindAncestor, findAncestor, findAncestor, hasParentNode, isDescendantOfcontainsWithin, containsWithinRange, getBegin, getEnd, hasRangepublic FieldDeclaration()
public FieldDeclaration(NodeList<Modifier> modifiers, VariableDeclarator variable)
public FieldDeclaration(NodeList<Modifier> modifiers, NodeList<VariableDeclarator> variables)
public FieldDeclaration(NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<VariableDeclarator> variables)
public FieldDeclaration(TokenRange tokenRange, NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, NodeList<VariableDeclarator> variables)
public FieldDeclaration(NodeList<Modifier> modifiers, Type type, String name)
FieldDeclaration.modifiers - modifierstype - typename - field namepublic <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitableaccept in interface VisitableR - the type of the return value of the visitorA - the type the user argument passed to the visitorv - the visitor implementationarg - the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitablepublic NodeList<Modifier> getModifiers()
getModifiers in interface NodeWithModifiers<FieldDeclaration>Modifierpublic NodeList<VariableDeclarator> getVariables()
getVariables in interface NodeWithVariables<FieldDeclaration>public FieldDeclaration setModifiers(NodeList<Modifier> modifiers)
setModifiers in interface NodeWithModifiers<FieldDeclaration>public FieldDeclaration setVariables(NodeList<VariableDeclarator> variables)
setVariables in interface NodeWithVariables<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 boolean isTransient()
public boolean isVolatile()
public FieldDeclaration setTransient(boolean set)
public FieldDeclaration setVolatile(boolean set)
public boolean isStatic()
isStatic in interface NodeWithStaticModifier<FieldDeclaration>static is explicitly added to this node. If the node is implicitly static
without an explicit modifier (e.g. nested records), this method should be overridden.public boolean isFinal()
isFinal in interface NodeWithFinalModifier<FieldDeclaration>final is explicitly added to this node. If the node is implicitly final
without an explicit modifier (e.g. records, and components of a record), this method should be overridden.public boolean isPublic()
isPublic in interface NodeWithPublicModifier<FieldDeclaration>public boolean remove(Node node)
remove in class BodyDeclaration<FieldDeclaration>public FieldDeclaration clone()
clone in class BodyDeclaration<FieldDeclaration>public FieldDeclarationMetaModel getMetaModel()
getMetaModel in class BodyDeclaration<FieldDeclaration>public boolean replace(Node node, Node replacementNode)
replace in class BodyDeclaration<FieldDeclaration>public boolean isFieldDeclaration()
isFieldDeclaration in class BodyDeclaration<FieldDeclaration>public FieldDeclaration asFieldDeclaration()
asFieldDeclaration in class BodyDeclaration<FieldDeclaration>public void ifFieldDeclaration(Consumer<FieldDeclaration> action)
ifFieldDeclaration in class BodyDeclaration<FieldDeclaration>public ResolvedFieldDeclaration resolve()
resolve in interface Resolvable<ResolvedFieldDeclaration>public Optional<FieldDeclaration> toFieldDeclaration()
toFieldDeclaration in class BodyDeclaration<FieldDeclaration>Copyright © 2007–2024. All rights reserved.