public class GrailsASTUtils extends java.lang.Object
Helper methods for working with Groovy AST trees.
Modifiers | Name | Description |
---|---|---|
private static @interface |
GrailsASTUtils.GrailsDelegatingConstructor |
Modifiers | Name | Description |
---|---|---|
static org.codehaus.groovy.syntax.Token |
ASSIGNMENT_OPERATOR |
|
private static org.codehaus.groovy.ast.ClassNode |
COMPILESTATIC_CLASS_NODE |
|
static java.lang.String |
DOMAIN_DIR |
|
private static org.codehaus.groovy.ast.ClassNode |
ENHANCED_CLASS_NODE |
|
static org.codehaus.groovy.syntax.Token |
EQUALS_OPERATOR |
|
static java.lang.String |
GRAILS_APP_DIR |
|
static org.codehaus.groovy.ast.ClassNode |
INTEGER_CLASS_NODE |
|
static org.codehaus.groovy.syntax.Token |
LOGICAL_AND_OPERATOR |
|
static java.lang.String |
METHOD_MISSING_METHOD_NAME |
|
static org.codehaus.groovy.ast.ClassNode |
MISSING_METHOD_EXCEPTION |
|
static org.codehaus.groovy.syntax.Token |
NOT_EQUALS_OPERATOR |
|
static org.codehaus.groovy.ast.expr.ConstantExpression |
NULL_EXPRESSION |
|
static java.lang.String |
OBJECT_CLASS |
|
static org.codehaus.groovy.ast.ClassNode |
OBJECT_CLASS_NODE |
|
static java.lang.String |
STATIC_METHOD_MISSING_METHOD_NAME |
|
private static org.codehaus.groovy.ast.ClassNode |
TYPECHECKINGMODE_CLASS_NODE |
|
static org.codehaus.groovy.ast.ClassNode |
VOID_CLASS_NODE |
|
static org.codehaus.groovy.ast.expr.ArgumentListExpression |
ZERO_ARGUMENTS |
|
static org.codehaus.groovy.ast.Parameter[] |
ZERO_PARAMETERS |
|
private static java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> |
emptyGenericsPlaceHoldersMap |
Type Params | Return Type | Name and description |
---|---|---|
|
public static void |
addAnnotationIfNecessary(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Adds an annotation to the give nclass node if it doesn't already exist |
|
public static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Adds an annotation to the given class node or returns the existing annotation |
|
public static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass, java.util.Map<java.lang.String, java.lang.Object> members) Adds an annotation to the given class node or returns the existing annotation |
|
public static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode annotationClassNode) |
|
public static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode annotationClassNode, java.util.Map<java.lang.String, java.lang.Object> members) |
|
private static org.codehaus.groovy.ast.expr.VariableExpression |
addApiVariableDeclaration(org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod, org.codehaus.groovy.ast.stmt.BlockStatement methodBody) |
|
public static org.codehaus.groovy.ast.AnnotatedNode |
addCompileStaticAnnotation(org.codehaus.groovy.ast.AnnotatedNode annotatedNode) Marks a method to be staticly compiled |
|
public static org.codehaus.groovy.ast.AnnotatedNode |
addCompileStaticAnnotation(org.codehaus.groovy.ast.AnnotatedNode annotatedNode, boolean skip) Adds
|
|
public static org.codehaus.groovy.ast.ConstructorNode |
addDelegateConstructor(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode constructorMethod, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders) Adds or modifies an existing constructor to delegate to the given static constructor method for initialization logic. |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod) Adds a delegate method to the target class node where the first argument is to the delegate method is 'this'. |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod, org.codehaus.groovy.ast.AnnotationNode markerAnnotation) |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod, boolean thisAsFirstArgument) |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod, org.codehaus.groovy.ast.AnnotationNode markerAnnotation, boolean thisAsFirstArgument) |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod, org.codehaus.groovy.ast.AnnotationNode markerAnnotation, boolean thisAsFirstArgument, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders) |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.MethodNode declaredMethod, org.codehaus.groovy.ast.AnnotationNode markerAnnotation, boolean thisAsFirstArgument, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders, boolean noNullCheck) Adds a delegate method to the target class node where the first argument is to the delegate method is 'this'. |
|
public static void |
addDelegateInstanceMethods(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode delegateNode, org.codehaus.groovy.ast.expr.Expression delegateInstance) |
|
public static void |
addDelegateInstanceMethods(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode delegateNode, org.codehaus.groovy.ast.expr.Expression delegateInstance, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders) |
|
public static void |
addDelegateInstanceMethods(org.codehaus.groovy.ast.ClassNode supportedSuperType, org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode delegateNode, org.codehaus.groovy.ast.expr.Expression delegateInstance) |
|
public static void |
addDelegateInstanceMethods(org.codehaus.groovy.ast.ClassNode supportedSuperType, org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode delegateNode, org.codehaus.groovy.ast.expr.Expression delegateInstance, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders, boolean noNullCheck, boolean addCompileStatic) |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateStaticMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode delegateMethod) Adds a static method call to given class node that delegates to the given method |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateStaticMethod(org.codehaus.groovy.ast.expr.Expression expression, org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode delegateMethod) Adds a static method to the given class node that delegates to the given method and resolves the object to invoke the method on from the given expression. |
|
public static org.codehaus.groovy.ast.MethodNode |
addDelegateStaticMethod(org.codehaus.groovy.ast.expr.Expression delegate, org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode delegateMethod, org.codehaus.groovy.ast.AnnotationNode markerAnnotation, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders, boolean noNullCheck) Adds a static method to the given class node that delegates to the given method and resolves the object to invoke the method on from the given expression. |
|
public static org.codehaus.groovy.ast.AnnotationNode |
addEnhancedAnnotation(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String enhancedFor) Add the grails.artefact.Enhanced annotation to classNode if it does not already exist and ensure that all of the features in the enhancedFor array are represented in the enhancedFor attribute of the Enhanced annnotation |
|
public static void |
addExpressionToAnnotationMember(org.codehaus.groovy.ast.AnnotationNode annotationNode, java.lang.String memberName, org.codehaus.groovy.ast.expr.Expression expression) Adds the given expression as a member of the given annotation |
|
public static org.codehaus.groovy.ast.FieldNode |
addFieldIfNonExistent(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode fieldType, java.lang.String fieldName) |
|
public static void |
addMethodIfNotPresent(org.codehaus.groovy.ast.ClassNode controllerClassNode, org.codehaus.groovy.ast.MethodNode methodNode) |
|
private static java.lang.String |
appliedTransformationKey(java.lang.Class<?> transformationClass) |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
applyDefaultMethodTarget(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, org.codehaus.groovy.ast.ClassNode targetClassNode) Set the method target of a MethodCallExpression to the first matching method with same number of arguments. |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
applyDefaultMethodTarget(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, java.lang.Class<?> targetClass) Set the method target of a MethodCallExpression to the first matching method with same number of arguments. |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
applyImplicitThis(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, boolean useImplicitThis) |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
applyMethodTarget(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, org.codehaus.groovy.ast.ClassNode targetClassNode, org.codehaus.groovy.ast.ClassNode targetParameterTypes) Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments. |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
applyMethodTarget(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, java.lang.Class<?> targetClass, java.lang.Class<?> targetParameterClassTypes) Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments. |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
applyMethodTarget(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, org.codehaus.groovy.ast.ClassNode targetClassNode, java.lang.Class<?> targetParameterClassTypes) Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments. |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
buildGetMapExpression(org.codehaus.groovy.ast.expr.Expression objectExpression, java.lang.String keyName) Build static direct call to get entry from Map |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
buildGetPropertyExpression(org.codehaus.groovy.ast.expr.Expression objectExpression, java.lang.String propertyName, org.codehaus.groovy.ast.ClassNode targetClassNode) Build static direct call to getter of a property |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
buildGetPropertyExpression(org.codehaus.groovy.ast.expr.Expression objectExpression, java.lang.String propertyName, org.codehaus.groovy.ast.ClassNode targetClassNode, boolean useBooleanGetter) Build static direct call to getter of a property |
|
public static org.codehaus.groovy.ast.expr.Expression |
buildGetThisObjectExpression(boolean inClosureBlock) |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
buildPutMapExpression(org.codehaus.groovy.ast.expr.Expression objectExpression, java.lang.String keyName, org.codehaus.groovy.ast.expr.Expression valueExpression) Build static direct call to put entry in Map |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
buildSetPropertyExpression(org.codehaus.groovy.ast.expr.Expression objectExpression, java.lang.String propertyName, org.codehaus.groovy.ast.ClassNode targetClassNode, org.codehaus.groovy.ast.expr.Expression valueExpression) Build static direct call to setter of a property |
|
public static org.codehaus.groovy.ast.expr.Expression |
buildThisExpression() |
|
public static org.codehaus.groovy.ast.AnnotationNode |
cloneAnnotation(org.codehaus.groovy.ast.AnnotationNode node) |
|
private static org.codehaus.groovy.ast.ClassNode[] |
convertTargetParameterTypes(java.lang.Class<?>[] targetParameterClassTypes) |
|
public static void |
copyAnnotations(org.codehaus.groovy.ast.AnnotatedNode from, org.codehaus.groovy.ast.AnnotatedNode to) |
|
public static void |
copyAnnotations(org.codehaus.groovy.ast.AnnotatedNode from, org.codehaus.groovy.ast.AnnotatedNode to, java.util.Set<java.lang.String> included, java.util.Set<java.lang.String> excluded) |
|
public static org.codehaus.groovy.ast.Parameter[] |
copyParameters(org.codehaus.groovy.ast.Parameter[] parameterTypes) |
|
public static org.codehaus.groovy.ast.Parameter[] |
copyParameters(org.codehaus.groovy.ast.Parameter[] parameterTypes, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders) |
|
public static org.codehaus.groovy.ast.expr.ArgumentListExpression |
createArgumentListFromParameters(org.codehaus.groovy.ast.Parameter[] parameterTypes, boolean thisAsFirstArgument, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders) Creates an argument list from the given parameter types. |
|
private static org.codehaus.groovy.ast.stmt.IfStatement |
createIfElseStatementForApiMethodCall(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression, org.codehaus.groovy.ast.expr.VariableExpression apiVar, org.codehaus.groovy.ast.stmt.ThrowStatement missingMethodException) |
|
private static org.codehaus.groovy.ast.stmt.ThrowStatement |
createMissingMethodThrowable(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode declaredMethodNode) |
|
public static org.codehaus.groovy.ast.stmt.ExpressionStatement |
createPrintlnStatement(java.lang.String message) |
|
public static org.codehaus.groovy.ast.stmt.ExpressionStatement |
createPrintlnStatement(java.lang.String message, java.lang.String variable) |
|
public static void |
error(org.codehaus.groovy.control.SourceUnit sourceUnit, org.codehaus.groovy.ast.ASTNode astNode, java.lang.String message) Generates a fatal compilation error. |
|
public static void |
error(org.codehaus.groovy.control.SourceUnit sourceUnit, org.codehaus.groovy.ast.ASTNode astNode, java.lang.String message, boolean fatal) Generates a fatal compilation error. |
|
public static void |
filterAnnotations(org.codehaus.groovy.ast.AnnotatedNode annotatedNode, java.util.Set<java.lang.String> classNamesToRetain, java.util.Set<java.lang.String> classNamesToRemove) |
|
public static org.codehaus.groovy.ast.AnnotationNode |
findAnnotation(org.codehaus.groovy.ast.ClassNode annotationClassNode, java.util.List<org.codehaus.groovy.ast.AnnotationNode> annotations) |
|
public static org.codehaus.groovy.ast.AnnotationNode |
findAnnotation(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<?> type) |
|
public static org.codehaus.groovy.ast.ConstructorNode |
findConstructor(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.Parameter[] constructorParams) Finds a constructor for the given class node and parameter types |
|
public static org.codehaus.groovy.ast.ClassNode |
findInterface(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode interfaceNode) |
|
public static java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> |
getAllAssociationMap(org.codehaus.groovy.ast.ClassNode classNode) |
|
public static java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> |
getAssocationMap(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String associationType) Returns a map containing the names and types of the given association type. eg. |
|
public static java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.codehaus.groovy.ast.expr.Expression>> |
getConstraintMetadata(org.codehaus.groovy.ast.expr.ClosureExpression closureExpression) Evaluates a constraints closure and returns metadata about the constraints configured in the closure. |
|
public static org.codehaus.groovy.ast.ConstructorNode |
getDefaultConstructor(org.codehaus.groovy.ast.ClassNode classNode) Obtains the default constructor for the given class node. |
|
public static java.lang.String |
getFullName(org.codehaus.groovy.ast.ClassNode classNode) Gets the full name of a ClassNode. |
|
public static org.codehaus.groovy.ast.ClassNode |
getFurthestParent(org.codehaus.groovy.ast.ClassNode classNode) |
|
public static org.codehaus.groovy.ast.ClassNode |
getFurthestUnresolvedParent(org.codehaus.groovy.ast.ClassNode classNode) |
|
private static java.lang.String |
getGrailsVersion() |
|
public static org.codehaus.groovy.ast.Parameter[] |
getRemainingParameterTypes(org.codehaus.groovy.ast.Parameter[] parameters) Gets the remaining parameters excluding the first parameter in the given list |
|
public static java.net.URL |
getSourceUrl(org.codehaus.groovy.control.SourceUnit source) Find URL of SourceUnit |
|
public static java.net.URL |
getSourceUrl(org.codehaus.groovy.ast.ClassNode classNode) |
|
public static boolean |
hasAnnotation(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Returns true if classNode is marked with annotationClass |
|
public static boolean |
hasAnnotation(org.codehaus.groovy.ast.MethodNode methodNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) Returns true if MethodNode is marked with annotationClass |
|
public static boolean |
hasAnyAnnotations(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationsToLookFor)
|
|
public static boolean |
hasOrInheritsProperty(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String propertyName) |
|
public static boolean |
hasParameters(org.codehaus.groovy.ast.MethodNode methodNode) |
|
public static boolean |
hasProperty(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String propertyName) Returns whether a classNode has the specified property or not |
|
public static boolean |
hasZeroArgsConstructor(org.codehaus.groovy.ast.ClassNode implementationNode) |
|
private static boolean |
implementsInterface(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String interfaceName) |
|
private static boolean |
implementsInterfaceInternal(org.codehaus.groovy.ast.ClassNode[] interfaces, java.lang.String interfaceName) |
|
public static boolean |
implementsOrInheritsZeroArgMethod(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String methodName, java.util.List ignoreClasses) |
|
public static boolean |
implementsZeroArgMethod(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String methodName) Tests whether the ClasNode implements the specified method name. |
|
public static boolean |
isApplied(org.codehaus.groovy.ast.ASTNode astNode, java.lang.Class<?> transformationClass) |
|
public static boolean |
isAssignableFrom(org.codehaus.groovy.ast.ClassNode superClass, org.codehaus.groovy.ast.ClassNode childClass) Determines if the class or interface represented by the superClass argument is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified subClass parameter. |
|
public static boolean |
isCandidateInstanceMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode declaredMethod) |
|
public static boolean |
isCandidateMethod(org.codehaus.groovy.ast.MethodNode declaredMethod) |
|
public static boolean |
isConstructorMethod(org.codehaus.groovy.ast.MethodNode declaredMethod) |
|
public static boolean |
isDomainClass(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.control.SourceUnit sourceNode) |
|
public static boolean |
isGetterMethod(org.codehaus.groovy.ast.MethodNode md) |
|
public static boolean |
isInheritedFromTrait(org.codehaus.groovy.ast.MethodNode methodNode) |
|
public static boolean |
isInnerClassNode(org.codehaus.groovy.ast.ClassNode classNode) Whether the given class node is an inner class |
|
public static boolean |
isSetterMethod(org.codehaus.groovy.ast.MethodNode md) |
|
public static boolean |
isSetterOrGetterMethod(org.codehaus.groovy.ast.MethodNode md) |
|
public static boolean |
isSubclassOf(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String parentClassName) Returns true if the given class name is a parent class of the given class |
|
public static boolean |
isSubclassOfOrImplementsInterface(org.codehaus.groovy.ast.ClassNode childClass, org.codehaus.groovy.ast.ClassNode superClass) |
|
public static boolean |
isSubclassOfOrImplementsInterface(org.codehaus.groovy.ast.ClassNode childClass, java.lang.String superClassName) |
|
public static void |
markApplied(org.codehaus.groovy.ast.ASTNode astNode, java.lang.Class<?> transformationClass) |
|
public static org.codehaus.groovy.ast.expr.MethodCallExpression |
noImplicitThis(org.codehaus.groovy.ast.expr.MethodCallExpression methodCallExpression) |
|
public static org.codehaus.groovy.ast.ClassNode |
nonGeneric(org.codehaus.groovy.ast.ClassNode type) |
|
public static org.codehaus.groovy.ast.ClassNode |
nonGeneric(org.codehaus.groovy.ast.ClassNode type, org.codehaus.groovy.ast.ClassNode wildcardReplacement) |
|
private static boolean |
parameterTypesMatch(org.codehaus.groovy.ast.Parameter[] parameters, org.codehaus.groovy.ast.ClassNode[] targetParameterTypes) |
|
public static boolean |
parametersEqual(org.codehaus.groovy.ast.Parameter[] a, org.codehaus.groovy.ast.Parameter[] b)
|
|
public static void |
processVariableScopes(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode) |
|
public static void |
processVariableScopes(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode methodNode) |
|
public static boolean |
removeAnnotation(org.codehaus.groovy.ast.MethodNode methodNode, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass) |
|
public static void |
removeCompileStaticAnnotations(org.codehaus.groovy.ast.AnnotatedNode annotatedNode) |
|
public static org.codehaus.groovy.ast.ClassNode |
replaceGenericsPlaceholders(org.codehaus.groovy.ast.ClassNode type, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders) |
|
public static org.codehaus.groovy.ast.ClassNode |
replaceGenericsPlaceholders(org.codehaus.groovy.ast.ClassNode type, java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsPlaceholders, org.codehaus.groovy.ast.ClassNode defaultPlaceholder) |
|
private static org.codehaus.groovy.ast.ASTNode |
resolveRedirect(org.codehaus.groovy.ast.ASTNode astNode) |
|
private static boolean |
shouldAddMarkerAnnotation(org.codehaus.groovy.ast.AnnotationNode markerAnnotation, org.codehaus.groovy.ast.MethodNode methodNode) |
|
public static void |
warning(org.codehaus.groovy.control.SourceUnit sourceUnit, org.codehaus.groovy.ast.ASTNode node, java.lang.String warningMessage) |
|
public static void |
wrapMethodBodyInTryCatchDebugStatements(org.codehaus.groovy.ast.MethodNode methodNode) Wraps a method body in try / catch logic that catches any errors and logs an error, but does not rethrow! |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Adds an annotation to the give nclass node if it doesn't already exist
classNode
- The class nodeannotationClass
- The annotation classAdds an annotation to the given class node or returns the existing annotation
classNode
- The class nodeannotationClass
- The annotation classAdds an annotation to the given class node or returns the existing annotation
classNode
- The class nodeannotationClass
- The annotation classMarks a method to be staticly compiled
Adds
Adds or modifies an existing constructor to delegate to the given static constructor method for initialization logic.
classNode
- The class nodeconstructorMethod
- The constructor static methodAdds a delegate method to the target class node where the first argument is to the delegate method is 'this'. In other words a method such as foo(Object instance, String bar) would be added with a signature of foo(String) and 'this' is passed to the delegate instance
classNode
- The class nodedelegate
- The expression that looks up the delegatedeclaredMethod
- The declared methodAdds a delegate method to the target class node where the first argument is to the delegate method is 'this'. In other words a method such as foo(Object instance, String bar) would be added with a signature of foo(String) and 'this' is passed to the delegate instance
classNode
- The class nodedelegate
- The expression that looks up the delegatedeclaredMethod
- The declared methodthisAsFirstArgument
- Whether 'this' should be passed as the first argument to the methodAdds a static method call to given class node that delegates to the given method
classNode
- The class nodedelegateMethod
- The delegate methodAdds a static method to the given class node that delegates to the given method and resolves the object to invoke the method on from the given expression.
expression
- The expressionclassNode
- The class nodedelegateMethod
- The delegate methodAdds a static method to the given class node that delegates to the given method and resolves the object to invoke the method on from the given expression.
delegate
- The expressionclassNode
- The class nodedelegateMethod
- The delegate methodmarkerAnnotation
- A marker annotation to be added to all methodsAdd the grails.artefact.Enhanced annotation to classNode if it does not already exist and ensure that all of the features in the enhancedFor array are represented in the enhancedFor attribute of the Enhanced annnotation
classNode
- the class to add the Enhanced annotation toenhancedFor
- an array of feature names to include in the enhancedFor attribute of the annotationAdds the given expression as a member of the given annotation
annotationNode
- The annotation nodememberName
- The name of the memberexpression
- The expressionSet the method target of a MethodCallExpression to the first matching method with same number of arguments. This doesn't check argument types.
Set the method target of a MethodCallExpression to the first matching method with same number of arguments. This doesn't check argument types.
Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments. A null parameter type will match any type
Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments.
Set the method target of a MethodCallExpression to the first matching method with same number and type of arguments.
Build static direct call to get entry from Map
Build static direct call to getter of a property
Build static direct call to getter of a property
Build static direct call to put entry in Map
Build static direct call to setter of a property
Creates an argument list from the given parameter types.
parameterTypes
- The parameter typesthisAsFirstArgument
- Whether to include a reference to 'this' as the first argumentGenerates a fatal compilation error.
sourceUnit
- the SourceUnitastNode
- the ASTNode which caused the errormessage
- The error messageGenerates a fatal compilation error.
sourceUnit
- the SourceUnitastNode
- the ASTNode which caused the errormessage
- The error messagefatal
- indicates if this is a fatal errorFinds a constructor for the given class node and parameter types
classNode
- The class nodeconstructorParams
- The parameter typesReturns a map containing the names and types of the given association type. eg. GrailsDomainClassProperty.HAS_MANY
classNode
- The target class ndoeassociationType
- The associationType Evaluates a constraints closure and returns metadata about the constraints configured in the closure. The
Map returned has property names as keys and the value associated with each of those property names is
a MapclosureExpression
- the closure expression to evaluate
Obtains the default constructor for the given class node.
classNode
- The class nodeGets the full name of a ClassNode.
classNode
- The class nodeGets the remaining parameters excluding the first parameter in the given list
parameters
- The parametersFind URL of SourceUnit source.getSource().getURI() fails in Groovy-Eclipse compiler
Returns true if classNode is marked with annotationClass
classNode
- A ClassNode to inspectannotationClass
- an annotation to look forReturns true if MethodNode is marked with annotationClass
methodNode
- A MethodNode to inspectannotationClass
- an annotation to look for
classNode
- a ClassNode to searchannotationsToLookFor
- Annotations to look forReturns whether a classNode has the specified property or not
classNode
- The ClassNodepropertyName
- The name of the propertyTests whether the ClasNode implements the specified method name.
classNode
- The ClassNodemethodName
- The method nameDetermines if the class or interface represented by the superClass argument is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified subClass parameter.
superClass
- The super class to checkchildClass
- The sub class the checkWhether the given class node is an inner class
classNode
- The class nodeReturns true if the given class name is a parent class of the given class
classNode
- The class nodeparentClassName
- the parent class name
Wraps a method body in try / catch logic that catches any errors and logs an error, but does not rethrow!
methodNode
- The method node