Package org.apache.groovy.ast.tools
Class MethodNodeUtils
java.lang.Object
org.apache.groovy.ast.tools.MethodNodeUtils
Utility class for working with MethodNodes
- 
Method SummaryModifier and TypeMethodDescriptionstatic BlockStatementgetCodeAsBlock(MethodNode mNode) Gets the code for a method (or constructor) as a block.static StringgetPropertyName(MethodNode mNode) For a method node potentially representing a property, returns the name of the property.static booleanisGetterCandidate(MethodNode mNode) Determines if given method is a getter candidate.static StringmethodDescriptor(MethodNode mNode) Return the method node's descriptor which includes its return type, name and parameter types without generics.static StringmethodDescriptor(MethodNode mNode, boolean pretty) Return the method node's descriptor which includes its return type, name and parameter types without generics.static StringReturn the method node's descriptor including its name and parameter types without generics.
- 
Method Details- 
methodDescriptorWithoutReturnTypeReturn the method node's descriptor including its name and parameter types without generics.- Parameters:
- mNode- the method node
- Returns:
- the method node's abbreviated descriptor excluding the return type
 
- 
methodDescriptorReturn the method node's descriptor which includes its return type, name and parameter types without generics.- Parameters:
- mNode- the method node
- Returns:
- the method node's descriptor
 
- 
methodDescriptorReturn the method node's descriptor which includes its return type, name and parameter types without generics.- Parameters:
- mNode- the method node
- pretty- whether to quote a name with spaces
- Returns:
- the method node's descriptor
 
- 
getPropertyNameFor a method node potentially representing a property, returns the name of the property.- Parameters:
- mNode- a MethodNode
- Returns:
- the property name without the get/set/is prefix if a property or null
 
- 
getCodeAsBlockGets the code for a method (or constructor) as a block. If no code is found, an empty block will be returned. If a single non-block statement is found, a block containing that statement will be returned. Otherwise the existing block statement will be returned. The originalnodeis not modified.- Parameters:
- mNode- the method (or constructor) node
- Returns:
- the found or created block statement
 
- 
isGetterCandidateDetermines if given method is a getter candidate.- Since:
- 4.0.0
 
 
-