public class Parameter extends Node implements NodeWithType<Parameter,Type>, NodeWithAnnotations<Parameter>, NodeWithSimpleName<Parameter>, NodeWithFinalModifier<Parameter>, Resolvable<ResolvedParameterDeclaration>
int abc(String x, float
y) {...}
Node.BreadthFirstIterator, Node.DirectChildrenIterator, Node.ObserverRegistrationMode, Node.ParentsVisitor, Node.Parsedness, Node.PostOrderIterator, Node.PreOrderIterator, Node.TreeTraversal
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, LINE_SEPARATOR_KEY, NODE_BY_BEGIN_POSITION, PHANTOM_KEY, prettyPrinterNoCommentsConfiguration, PRINTER_KEY, SYMBOL_RESOLVER_KEY
Constructor and Description |
---|
Parameter() |
Parameter(NodeList<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
Type type,
boolean isVarArgs,
NodeList<AnnotationExpr> varArgsAnnotations,
SimpleName name) |
Parameter(NodeList<Modifier> modifiers,
Type type,
SimpleName name) |
Parameter(TokenRange tokenRange,
NodeList<Modifier> modifiers,
NodeList<AnnotationExpr> annotations,
Type type,
boolean isVarArgs,
NodeList<AnnotationExpr> varArgsAnnotations,
SimpleName name)
This constructor is used by the parser and is considered private.
|
Parameter(Type type,
SimpleName name) |
Parameter(Type type,
String name)
Creates a new
Parameter . |
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.
|
Parameter |
clone() |
NodeList<AnnotationExpr> |
getAnnotations() |
ParameterMetaModel |
getMetaModel() |
NodeList<Modifier> |
getModifiers()
Return the modifiers of this parameter declaration.
|
SimpleName |
getName() |
Type |
getType()
Gets the type
|
NodeList<AnnotationExpr> |
getVarArgsAnnotations() |
boolean |
isFinal()
Record components (parameters here) are implicitly final, even without the explicitly-added modifier.
|
boolean |
isVarArgs() |
boolean |
remove(Node node) |
boolean |
replace(Node node,
Node replacementNode) |
ResolvedParameterDeclaration |
resolve() |
Parameter |
setAnnotations(NodeList<AnnotationExpr> annotations) |
Parameter |
setModifiers(NodeList<Modifier> modifiers) |
Parameter |
setName(SimpleName name) |
Parameter |
setType(Type type)
Sets the type
|
Parameter |
setVarArgs(boolean isVarArgs) |
Parameter |
setVarArgsAnnotations(NodeList<AnnotationExpr> varArgsAnnotations) |
addOrphanComment, containsData, createDefaultPrinter, createDefaultPrinter, customInitialization, equals, findAll, findAll, findAll, findCompilationUnit, 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, walk
finalize, getClass, notify, notifyAll, wait, wait, wait
getTypeAsString, setType, setType, tryAddImportToParentCompilationUnit
addAndGetAnnotation, addAndGetAnnotation, addAnnotation, addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent, setAnnotation, tryAddImportToParentCompilationUnit
getNameAsExpression, getNameAsString, setName
setFinal
addModifier, getAccessSpecifier, hasModifier, removeModifier, setModifier, setModifiers
findAncestor, findAncestor, findAncestor, hasParentNode, isDescendantOf
containsWithin, containsWithinRange, getBegin, getEnd, hasRange
public Parameter()
public Parameter(Type type, SimpleName name)
public Parameter(Type type, String name)
Parameter
.type
- type of the parametername
- name of the parameterpublic Parameter(NodeList<Modifier> modifiers, Type type, SimpleName name)
public Parameter(NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, Type type, boolean isVarArgs, NodeList<AnnotationExpr> varArgsAnnotations, SimpleName name)
public Parameter(TokenRange tokenRange, NodeList<Modifier> modifiers, NodeList<AnnotationExpr> annotations, Type type, boolean isVarArgs, NodeList<AnnotationExpr> varArgsAnnotations, SimpleName name)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitable
accept
in interface Visitable
R
- 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)
Visitable
public Type getType()
NodeWithType
getType
in interface NodeWithType<Parameter,Type>
public boolean isVarArgs()
public Parameter setType(Type type)
NodeWithType
setType
in interface NodeWithType<Parameter,Type>
type
- the typepublic Parameter setVarArgs(boolean isVarArgs)
public NodeList<AnnotationExpr> getAnnotations()
getAnnotations
in interface NodeWithAnnotations<Parameter>
public SimpleName getName()
getName
in interface NodeWithSimpleName<Parameter>
public NodeList<Modifier> getModifiers()
getModifiers
in interface NodeWithModifiers<Parameter>
Modifier
public Parameter setAnnotations(NodeList<AnnotationExpr> annotations)
setAnnotations
in interface NodeWithAnnotations<Parameter>
annotations
- a null value is currently treated as an empty list. This behavior could change in the future,
so please avoid passing nullpublic Parameter setName(SimpleName name)
setName
in interface NodeWithSimpleName<Parameter>
public Parameter setModifiers(NodeList<Modifier> modifiers)
setModifiers
in interface NodeWithModifiers<Parameter>
public NodeList<AnnotationExpr> getVarArgsAnnotations()
public Parameter setVarArgsAnnotations(NodeList<AnnotationExpr> varArgsAnnotations)
public ParameterMetaModel getMetaModel()
getMetaModel
in class Node
public ResolvedParameterDeclaration resolve()
resolve
in interface Resolvable<ResolvedParameterDeclaration>
public boolean isFinal()
final
has been explicitly added to this parameter,
you should use node.hasModifier(Modifier.Keyword.FINAL)
isFinal
in interface NodeWithFinalModifier<Parameter>
Copyright © 2007–2024. All rights reserved.