Search in sources :

Example 16 with PackageNode

use of org.codehaus.groovy.ast.PackageNode in project spring-boot by spring-projects.

the class ResolveDependencyCoordinatesTransformationTests method transformationOfAnnotationOnPackage.

@Test
void transformationOfAnnotationOnPackage() {
    PackageNode packageNode = new PackageNode("test");
    packageNode.addAnnotation(this.grabAnnotation);
    this.moduleNode.setPackage(packageNode);
    assertGrabAnnotationHasBeenTransformed();
}
Also used : PackageNode(org.codehaus.groovy.ast.PackageNode) Test(org.junit.jupiter.api.Test)

Example 17 with PackageNode

use of org.codehaus.groovy.ast.PackageNode in project groovy-core by groovy.

the class ASTHelper method setPackage.

public PackageNode setPackage(String packageName, List<AnnotationNode> annotations) {
    this.packageName = packageName;
    if (packageName != null && packageName.length() > 0) {
        packageName += '.';
    }
    PackageNode packageNode = new PackageNode(packageName);
    packageNode.addAnnotations(annotations);
    output.setPackage(packageNode);
    return packageNode;
}
Also used : PackageNode(org.codehaus.groovy.ast.PackageNode)

Aggregations

PackageNode (org.codehaus.groovy.ast.PackageNode)17 ClassNode (org.codehaus.groovy.ast.ClassNode)10 AnnotationNode (org.codehaus.groovy.ast.AnnotationNode)5 MethodNode (org.codehaus.groovy.ast.MethodNode)5 GroovyRuntimeException (groovy.lang.GroovyRuntimeException)3 Constructor (java.lang.reflect.Constructor)3 Field (java.lang.reflect.Field)3 Method (java.lang.reflect.Method)3 FieldNode (org.codehaus.groovy.ast.FieldNode)3 Parameter (org.codehaus.groovy.ast.Parameter)3 Test (org.junit.jupiter.api.Test)3 MalformedParameterizedTypeException (java.lang.reflect.MalformedParameterizedTypeException)2 AnnotatedNode (org.codehaus.groovy.ast.AnnotatedNode)2 ImportNode (org.codehaus.groovy.ast.ImportNode)2 InnerClassNode (org.codehaus.groovy.ast.InnerClassNode)2 InterfaceHelperClassNode (org.codehaus.groovy.ast.InterfaceHelperClassNode)2 DeclarationExpression (org.codehaus.groovy.ast.expr.DeclarationExpression)2 MopWriter (org.codehaus.groovy.classgen.asm.MopWriter)2 WriterController (org.codehaus.groovy.classgen.asm.WriterController)2 WriterControllerFactory (org.codehaus.groovy.classgen.asm.WriterControllerFactory)2