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
Constructors -
Method Summary
Modifier 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.AnnotatedNode
addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSyntheticMethods inherited from class org.codehaus.groovy.ast.ASTNode
copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
trueif 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:
trueif annotation method has a default value
-
setAnnotationDefault
public void setAnnotationDefault(boolean hasDefaultValue) -
isScriptBody
public boolean isScriptBody()- Returns:
trueif 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()- Since:
- 4.0.0
-
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:
trueif this class is public but had no explicit public modifier
-
setSyntheticPublic
public void setSyntheticPublic(boolean syntheticPublic) -
getText
-
toString
-
MethodNodeUtils.methodDescriptor(MethodNode, boolean)