Package org.codehaus.groovy.ast
Class MethodNode
java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotatedNode
org.codehaus.groovy.ast.MethodNode
- All Implemented Interfaces:
GroovydocHolder<AnnotatedNode>
,NodeMetaDataHandler
- Direct Known Subclasses:
ConstructorNode
,ExtensionMethodNode
Represents a method declaration.
-
Field Summary
Fields inherited from interface groovy.lang.groovydoc.GroovydocHolder
DOC_COMMENT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetCode()
int
getName()
getText()
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.getTypeDescriptor
(boolean pretty) Deprecated.boolean
boolean
boolean
boolean
boolean
boolean
boolean
isFinal()
boolean
boolean
boolean
boolean
isPublic()
boolean
boolean
isStatic()
boolean
boolean
Indicates that this method has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code.boolean
void
setAnnotationDefault
(boolean hasDefaultValue) void
void
setGenericsTypes
(GenericsType[] genericsTypes) void
Sets the flag for this method to indicate it is a script body implementation.void
setModifiers
(int modifiers) void
setParameters
(Parameter[] parameters) void
setReturnType
(ClassNode returnType) void
setSyntheticPublic
(boolean syntheticPublic) void
setVariableScope
(VariableScope variableScope) toString()
Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode
addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic
Methods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler
copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData
-
Constructor Details
-
MethodNode
protected MethodNode() -
MethodNode
-
-
Method Details
-
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. For simplicity, we use the format of a Java declaration without parameter names or generics. -
getTypeDescriptor
Deprecated. -
getCode
-
setCode
-
getModifiers
public int getModifiers() -
setModifiers
public void setModifiers(int modifiers) -
getName
-
getParameters
-
setParameters
-
hasDefaultValue
public boolean hasDefaultValue()- Returns:
true
if any parameter has a default value
-
getReturnType
-
setReturnType
-
isDynamicReturnType
public boolean isDynamicReturnType() -
isVoidMethod
public boolean isVoidMethod() -
getVariableScope
-
setVariableScope
-
isAbstract
public boolean isAbstract() -
isDefault
public boolean isDefault() -
isFinal
public boolean isFinal() -
isStatic
public boolean isStatic() -
isPublic
public boolean isPublic() -
isPrivate
public boolean isPrivate() -
isProtected
public boolean isProtected() -
isPackageScope
public boolean isPackageScope() -
getExceptions
-
getFirstStatement
-
getGenericsTypes
-
setGenericsTypes
-
hasAnnotationDefault
public boolean hasAnnotationDefault()- Returns:
true
if annotation method has a default value
-
setAnnotationDefault
public void setAnnotationDefault(boolean hasDefaultValue) -
isScriptBody
public boolean isScriptBody()- Returns:
true
if this method is the run method from a script
-
setIsScriptBody
public void setIsScriptBody()Sets the flag for this method to indicate it is a script body implementation.- See Also:
-
isStaticConstructor
public boolean isStaticConstructor() -
isConstructor
public boolean isConstructor() -
isSyntheticPublic
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. 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.- Returns:
true
if this class is public but had no explicit public modifier
-
setSyntheticPublic
public void setSyntheticPublic(boolean syntheticPublic) -
getText
-
toString
-
MethodNodeUtils.methodDescriptor(MethodNode, boolean)