public final class MethodDeclaration extends BodyDeclaration<MethodDeclaration> implements NodeWithJavaDoc<MethodDeclaration>, NodeWithDeclaration, NodeWithName<MethodDeclaration>, NodeWithType<MethodDeclaration>, NodeWithModifiers<MethodDeclaration>, NodeWithParameters<MethodDeclaration>, NodeWithThrowable<MethodDeclaration>, NodeWithBlockStmt<MethodDeclaration>
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE
Constructor and Description |
---|
MethodDeclaration() |
MethodDeclaration(EnumSet<Modifier> modifiers,
List<AnnotationExpr> annotations,
List<TypeParameter> typeParameters,
Type type,
String name,
List<Parameter> parameters,
int arrayCount,
List<ReferenceType> throws_,
BlockStmt body) |
MethodDeclaration(EnumSet<Modifier> modifiers,
Type type,
String name) |
MethodDeclaration(EnumSet<Modifier> modifiers,
Type type,
String name,
List<Parameter> parameters) |
MethodDeclaration(Range range,
EnumSet<Modifier> modifiers,
List<AnnotationExpr> annotations,
List<TypeParameter> typeParameters,
Type type,
String name,
List<Parameter> parameters,
int arrayCount,
List<ReferenceType> throws_,
BlockStmt body) |
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.
|
int |
getArrayCount() |
BlockStmt |
getBody() |
String |
getDeclarationAsString()
As
NodeWithDeclaration.getDeclarationAsString(boolean, boolean, boolean) including
the modifiers, the throws clause and the parameters with both type and name. |
String |
getDeclarationAsString(boolean includingModifiers,
boolean includingThrows)
As
NodeWithDeclaration.getDeclarationAsString(boolean, boolean, boolean) including
the parameters with both type and name. |
String |
getDeclarationAsString(boolean includingModifiers,
boolean includingThrows,
boolean includingParameterName)
The declaration returned has this schema:
[accessSpecifier] [static] [abstract] [final] [native]
[synchronized] returnType methodName ([paramType [paramName]])
[throws exceptionsList]
|
JavadocComment |
getJavaDoc()
Gets the JavaDoc for this node.
|
EnumSet<Modifier> |
getModifiers()
Return the modifiers of this member declaration.
|
String |
getName() |
NameExpr |
getNameExpr() |
List<Parameter> |
getParameters() |
List<ReferenceType> |
getThrows() |
Type |
getType()
Gets the type
|
List<TypeParameter> |
getTypeParameters() |
boolean |
isDefault() |
void |
setArrayCount(int arrayCount) |
MethodDeclaration |
setBody(BlockStmt body) |
MethodDeclaration |
setDefault(boolean isDefault) |
MethodDeclaration |
setModifiers(EnumSet<Modifier> modifiers) |
MethodDeclaration |
setName(String name) |
MethodDeclaration |
setNameExpr(NameExpr name) |
MethodDeclaration |
setParameters(List<Parameter> parameters) |
MethodDeclaration |
setThrows(List<ReferenceType> throws_) |
MethodDeclaration |
setType(Type type)
Sets the type
|
MethodDeclaration |
setTypeParameters(List<TypeParameter> typeParameters) |
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
addAndGetParameter, addAndGetParameter, addAndGetParameter, addParameter, addParameter, addParameter, getParamByName, getParamByType, getParamByType
addThrows, addThrows, isThrows, isThrows
createBody
addAnnotation, addAnnotation, addMarkerAnnotation, addMarkerAnnotation, addSingleMemberAnnotation, addSingleMemberAnnotation, getAnnotationByClass, getAnnotationByName, isAnnotationPresent, isAnnotationPresent
public MethodDeclaration()
public MethodDeclaration(EnumSet<Modifier> modifiers, Type type, String name, List<Parameter> parameters)
public MethodDeclaration(EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, Type type, String name, List<Parameter> parameters, int arrayCount, List<ReferenceType> throws_, BlockStmt body)
public MethodDeclaration(Range range, EnumSet<Modifier> modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, Type type, String name, List<Parameter> parameters, int arrayCount, List<ReferenceType> throws_, BlockStmt body)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Node
public <A> void accept(VoidVisitor<A> v, A arg)
Node
public int getArrayCount()
public BlockStmt getBody()
getBody
in interface NodeWithBlockStmt<MethodDeclaration>
public EnumSet<Modifier> getModifiers()
getModifiers
in interface NodeWithModifiers<MethodDeclaration>
Modifier
public String getName()
getName
in interface NodeWithName<MethodDeclaration>
public NameExpr getNameExpr()
public List<Parameter> getParameters()
getParameters
in interface NodeWithParameters<MethodDeclaration>
public List<ReferenceType> getThrows()
getThrows
in interface NodeWithThrowable<MethodDeclaration>
public Type getType()
NodeWithType
getType
in interface NodeWithType<MethodDeclaration>
public List<TypeParameter> getTypeParameters()
public void setArrayCount(int arrayCount)
public MethodDeclaration setBody(BlockStmt body)
setBody
in interface NodeWithBlockStmt<MethodDeclaration>
public MethodDeclaration setModifiers(EnumSet<Modifier> modifiers)
setModifiers
in interface NodeWithModifiers<MethodDeclaration>
public MethodDeclaration setName(String name)
setName
in interface NodeWithName<MethodDeclaration>
public MethodDeclaration setNameExpr(NameExpr name)
public MethodDeclaration setParameters(List<Parameter> parameters)
setParameters
in interface NodeWithParameters<MethodDeclaration>
public MethodDeclaration setThrows(List<ReferenceType> throws_)
setThrows
in interface NodeWithThrowable<MethodDeclaration>
public MethodDeclaration setType(Type type)
NodeWithType
setType
in interface NodeWithType<MethodDeclaration>
type
- the typepublic MethodDeclaration setTypeParameters(List<TypeParameter> typeParameters)
public boolean isDefault()
public MethodDeclaration setDefault(boolean isDefault)
public String getDeclarationAsString()
NodeWithDeclaration
NodeWithDeclaration.getDeclarationAsString(boolean, boolean, boolean)
including
the modifiers, the throws clause and the parameters with both type and name.getDeclarationAsString
in interface NodeWithDeclaration
public String getDeclarationAsString(boolean includingModifiers, boolean includingThrows)
NodeWithDeclaration
NodeWithDeclaration.getDeclarationAsString(boolean, boolean, boolean)
including
the parameters with both type and name.getDeclarationAsString
in interface NodeWithDeclaration
includingModifiers
- flag to include the modifiers (if present) in the string producedincludingThrows
- flag to include the throws clause (if present) in the string producedpublic String getDeclarationAsString(boolean includingModifiers, boolean includingThrows, boolean includingParameterName)
getDeclarationAsString
in interface NodeWithDeclaration
includingModifiers
- flag to include the modifiers (if present) in the string producedincludingThrows
- flag to include the throws clause (if present) in the string producedincludingParameterName
- flag to include the parameter name (while the parameter type is always included) in the string producedpublic JavadocComment getJavaDoc()
NodeWithJavaDoc
getJavaDoc
in interface NodeWithJavaDoc<MethodDeclaration>
Copyright © 2007–2016. All rights reserved.