public class MethodNode extends AnnotatedNode implements org.objectweb.asm.Opcodes
Represents a method declaration.
Constructor and description |
---|
protected MethodNode
() |
MethodNode
(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code) |
Type Params | Return Type | Name and description |
---|---|---|
public Statement |
getCode() | |
public ClassNode[] |
getExceptions() | |
public Statement |
getFirstStatement() | |
public GenericsType[] |
getGenericsTypes() | |
public int |
getModifiers() | |
public String |
getName() | |
public Parameter[] |
getParameters() | |
public ClassNode |
getReturnType() | |
public String |
getText() Provides a nicely formatted string of the method definition. | |
public String |
getTypeDescriptor() The type descriptor for a method node is a string containing the name of the method, its return type, and its parameter types in a canonical form. | |
public VariableScope |
getVariableScope() | |
public boolean |
hasAnnotationDefault()
| |
public boolean |
hasDefaultValue()
| |
public boolean |
isAbstract() | |
public boolean |
isDefault() | |
public boolean |
isDynamicReturnType() | |
public boolean |
isFinal() | |
public boolean |
isPackageScope() | |
public boolean |
isPrivate() | |
public boolean |
isProtected() | |
public boolean |
isPublic() | |
public boolean |
isScriptBody()
| |
public boolean |
isStatic() | |
public boolean |
isStaticConstructor() | |
public boolean |
isSyntheticPublic() Indicates that this method has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code. | |
public boolean |
isVoidMethod() | |
public void |
setAnnotationDefault(boolean hasDefaultValue) | |
public void |
setCode(Statement code) | |
public void |
setGenericsTypes(GenericsType[] genericsTypes) | |
public void |
setIsScriptBody() Sets the flag for this method to indicate it is a script body implementation. | |
public void |
setModifiers(int modifiers) | |
public void |
setParameters(Parameter[] parameters) | |
public void |
setReturnType(ClassNode returnType) | |
public void |
setSyntheticPublic(boolean syntheticPublic) | |
public void |
setVariableScope(VariableScope variableScope) | |
public String |
toString() |
Methods inherited from class | Name |
---|---|
class AnnotatedNode | addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
class ASTNode | copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
Provides a nicely formatted string of the method definition. For simplicity, generic types on some of the elements are not displayed.
The type descriptor for a method node is a string containing the name of the method, its return type, and its parameter types in a canonical form. For simplicity, we use the format of a Java declaration without parameter names or generics.
true
if annotation method has a default valuetrue
if any parameter has a default valuetrue
if this method is the run method from a scriptIndicates that this method has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code. I.e. it remembers that it has applied Groovy's "public methods by default" rule. This property is typically only of interest to AST transform writers.
true
if this class is public but had no explicit public modifierSets the flag for this method to indicate it is a script body implementation.
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/ast/MethodNode.html