Utility methods for dealing with Groovy ASTs
Modifiers | Name | Description |
---|---|---|
static java.util.regex.Pattern |
DOMAIN_PATH_PATTERN |
|
static java.lang.String |
DOMAIN_TYPE |
|
static java.lang.String |
GRAILS_APP_DIR |
The name of the Grails application directory |
static org.codehaus.groovy.ast.ClassNode |
OBJECT_CLASS_NODE |
|
static java.lang.String |
REGEX_FILE_SEPARATOR |
|
static java.lang.Object |
TRANSFORM_APPLIED_MARKER |
|
static org.codehaus.groovy.ast.expr.ArgumentListExpression |
ZERO_ARGUMENTS |
|
static org.codehaus.groovy.ast.Parameter[] |
ZERO_PARAMETERS |
Type Params | Return Type | Name and description |
---|---|---|
|
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 |
|
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 |
|
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 |
|
static org.codehaus.groovy.ast.AnnotationNode |
addAnnotationOrGetExisting(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode annotationClassNode) |
|
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) |
|
static void |
addTransformedEntityName(java.lang.String name) @param name Adds the name of a transformed entity |
|
static org.codehaus.groovy.ast.AnnotationNode |
cloneAnnotation(org.codehaus.groovy.ast.AnnotationNode node) |
|
static void |
copyAnnotations(org.codehaus.groovy.ast.AnnotatedNode from, org.codehaus.groovy.ast.AnnotatedNode to) |
|
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) |
|
static org.codehaus.groovy.ast.Parameter[] |
copyParameters(org.codehaus.groovy.ast.Parameter[] parameterTypes) |
|
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) |
|
static org.codehaus.groovy.ast.Parameter[] |
copyParameters(java.util.Map<java.lang.String, org.codehaus.groovy.ast.ClassNode> genericsSpec, org.codehaus.groovy.ast.Parameter[] parameterTypes, java.util.List<java.lang.String> currentMethodGenPlaceholders) |
|
static org.codehaus.groovy.ast.AnnotationNode |
findAnnotation(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class<?> type) |
|
static org.codehaus.groovy.ast.AnnotationNode |
findAnnotation(org.codehaus.groovy.ast.ClassNode annotationClassNode, java.util.List<org.codehaus.groovy.ast.AnnotationNode> annotations) |
|
static org.codehaus.groovy.ast.ClassNode |
findInterface(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String interfaceName) |
|
static org.codehaus.groovy.ast.ClassNode |
getFurthestUnresolvedParent(org.codehaus.groovy.ast.ClassNode classNode) |
|
static java.util.Collection<java.lang.String> |
getKnownEntityNames() @return The names of the transformed entities for this context |
|
static org.codehaus.groovy.ast.PropertyNode |
getPropertyFromHierarchy(org.codehaus.groovy.ast.ClassNode cn, java.lang.String name) Obtains a property from the class hierarchy |
|
static boolean |
hasOrInheritsProperty(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String propertyName) |
|
static boolean |
hasProperty(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String propertyName) Returns whether a classNode has the specified property or not |
|
static boolean |
implementsInterface(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String interfaceName) |
|
static boolean |
implementsOrInheritsZeroArgMethod(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String methodName) |
|
static boolean |
implementsZeroArgMethod(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String methodName) Tests whether the ClasNode implements the specified method name. |
|
static void |
injectTrait(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class traitClass) |
|
static boolean |
isDomainClass(java.net.URL url) Checks whether the file referenced by the given url is a domain class |
|
static boolean |
isDomainClass(org.codehaus.groovy.ast.ClassNode classNode) |
|
static boolean |
isEnum(org.codehaus.groovy.ast.ClassNode classNode) |
|
static boolean |
isGroovyType(org.codehaus.groovy.ast.ClassNode type) Whether the given type is a Groovy object |
|
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 |
|
static boolean |
isSubclassOfOrImplementsInterface(org.codehaus.groovy.ast.ClassNode childClass, org.codehaus.groovy.ast.ClassNode superClass) |
|
static boolean |
isSubclassOfOrImplementsInterface(org.codehaus.groovy.ast.ClassNode childClass, java.lang.String superClassName) |
|
static org.codehaus.groovy.ast.ClassNode |
nonGeneric(org.codehaus.groovy.ast.ClassNode type) |
|
static org.codehaus.groovy.ast.ClassNode |
nonGeneric(org.codehaus.groovy.ast.ClassNode type, org.codehaus.groovy.ast.ClassNode wildcardReplacement) |
|
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) |
|
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) |
|
static void |
warning(org.codehaus.groovy.control.SourceUnit sourceUnit, org.codehaus.groovy.ast.ASTNode node, java.lang.String warningMessage) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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() |
The name of the Grails application directory
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 class
name
- Adds the name of a transformed entity
Obtains a property from the class hierarchy
cn
- The class nodename
- The property nameReturns 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 nameChecks whether the file referenced by the given url is a domain class
url
- The URL instanceWhether the given type is a Groovy object
type
- The typeReturns true if the given class name is a parent class of the given class
classNode
- The class nodeparentClassName
- the parent class name