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 SummaryFields inherited from interface groovy.lang.groovydoc.GroovydocHolderDOC_COMMENT
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetCode()intgetName()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.booleanbooleanbooleanbooleanbooleanbooleanbooleanisFinal()booleanbooleanbooleanbooleanisPublic()booleanbooleanisStatic()booleanbooleanIndicates that this method has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code.booleanvoidsetAnnotationDefault(boolean hasDefaultValue) voidvoidsetGenericsTypes(GenericsType[] genericsTypes) voidSets the flag for this method to indicate it is a script body implementation.voidsetModifiers(int modifiers) voidsetParameters(Parameter[] parameters) voidsetReturnType(ClassNode returnType) voidsetSyntheticPublic(boolean syntheticPublic) voidsetVariableScope(VariableScope variableScope) toString()Methods inherited from class org.codehaus.groovy.ast.AnnotatedNodeaddAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSyntheticMethods inherited from class org.codehaus.groovy.ast.ASTNodecopyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visitMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandlercopyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, putNodeMetaData, removeNodeMetaData, setNodeMetaData
- 
Constructor Details- 
MethodNodeprotected MethodNode()
- 
MethodNode
 
- 
- 
Method Details- 
getTypeDescriptorThe 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.
- 
getTypeDescriptorDeprecated.
- 
getCode
- 
setCode
- 
getModifierspublic int getModifiers()
- 
setModifierspublic void setModifiers(int modifiers) 
- 
getName
- 
getParameters
- 
setParameters
- 
hasDefaultValuepublic boolean hasDefaultValue()- Returns:
- trueif any parameter has a default value
 
- 
getReturnType
- 
setReturnType
- 
isDynamicReturnTypepublic boolean isDynamicReturnType()
- 
isVoidMethodpublic boolean isVoidMethod()
- 
getVariableScope
- 
setVariableScope
- 
isAbstractpublic boolean isAbstract()
- 
isDefaultpublic boolean isDefault()
- 
isFinalpublic boolean isFinal()
- 
isStaticpublic boolean isStatic()
- 
isPublicpublic boolean isPublic()
- 
isPrivatepublic boolean isPrivate()
- 
isProtectedpublic boolean isProtected()
- 
isPackageScopepublic boolean isPackageScope()
- 
getExceptions
- 
getFirstStatement
- 
getGenericsTypes
- 
setGenericsTypes
- 
hasAnnotationDefaultpublic boolean hasAnnotationDefault()- Returns:
- trueif annotation method has a default value
 
- 
setAnnotationDefaultpublic void setAnnotationDefault(boolean hasDefaultValue) 
- 
isScriptBodypublic boolean isScriptBody()- Returns:
- trueif this method is the run method from a script
 
- 
setIsScriptBodypublic void setIsScriptBody()Sets the flag for this method to indicate it is a script body implementation.- See Also:
 
- 
isStaticConstructorpublic boolean isStaticConstructor()
- 
isConstructorpublic boolean isConstructor()- Since:
- 4.0.0
 
- 
isSyntheticPublicpublic 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:
- trueif this class is public but had no explicit public modifier
 
- 
setSyntheticPublicpublic void setSyntheticPublic(boolean syntheticPublic) 
- 
getText
- 
toString
 
- 
MethodNodeUtils.methodDescriptor(MethodNode, boolean)