Examples of addAnnotation()


Examples of org.codehaus.groovy.ast.Parameter.addAnnotation()

  public void transformationOfAnnotationOnMethodParameter() {
    ClassNode classNode = new ClassNode("Test", 0, new ClassNode(Object.class));
    this.moduleNode.addClass(classNode);

    Parameter parameter = new Parameter(new ClassNode(Object.class), "test");
    parameter.addAnnotation(this.grabAnnotation);

    MethodNode methodNode = new MethodNode("test", 0, new ClassNode(Void.class),
        new Parameter[] { parameter }, new ClassNode[0], null);
    classNode.addMethod(methodNode);
View Full Code Here

Examples of org.codehaus.groovy.ast.PropertyNode.addAnnotation()

            apiInstance = new MethodCallExpression(new ClassExpression(classNode), lookupMethodName, ZERO_ARGS);
            ((MethodCallExpression)apiInstance).setMethodTarget(lookupMethod);
        }
        else if (requiresAutowiring()) {
            PropertyNode propertyNode = new PropertyNode(apiInstanceProperty, Modifier.PUBLIC, implementationNode, classNode, constructorCallExpression, null, null);
            propertyNode.addAnnotation(AUTO_WIRED_ANNOTATION);
            if(getMarkerAnnotation() != null) {
                propertyNode.addAnnotation(getMarkerAnnotation());
            }
            classNode.addProperty(propertyNode);
        }
View Full Code Here

Examples of org.codehaus.groovy.ast.expr.DeclarationExpression.addAnnotation()

    ClassNode classNode = new ClassNode("Test", 0, new ClassNode(Object.class));
    this.moduleNode.addClass(classNode);

    DeclarationExpression declarationExpression = new DeclarationExpression(
        new VariableExpression("test"), null, new ConstantExpression("test"));
    declarationExpression.addAnnotation(this.grabAnnotation);

    BlockStatement code = new BlockStatement(
        Arrays.asList((Statement) new ExpressionStatement(declarationExpression)),
        new VariableScope());
View Full Code Here

Examples of org.drools.compiler.lang.descr.ConstraintConnectiveDescr.addAnnotation()

                  if ( state.backtracking==0 ) {
                     if( buildDescr  ) {
                                   ConstraintConnectiveDescr descr = ConstraintConnectiveDescr.newOr();
                                   descr.addOrMerge( result );
                                   descr.addOrMerge( right );
                                   if ( args != null ) { descr.addAnnotation( args ); }
                                   result = descr;
                               }
                            
                  }
View Full Code Here

Examples of org.drools.compiler.lang.descr.RuleDescr.addAnnotation()

        final RuleBuildContext context = mock( RuleBuildContext.class );
        final RuleImpl rule = mock( RuleImpl.class );

        // creates input object
        final RuleDescr ruleDescr = new RuleDescr( "my rule" );
        ruleDescr.addAnnotation( "ruleId",
                                 "123" );
        ruleDescr.addAnnotation( "author",
                                 "Bob Doe" );
        ruleDescr.addAnnotation( "text",
                                 "\"It's a quoted\\\" string\"" );
View Full Code Here

Examples of org.drools.compiler.lang.descr.TypeDeclarationDescr.addAnnotation()

    @Test
    public void testTypeDeclaration() throws Exception {
        PackageDescr pkgDescr = new PackageDescr( "org.drools.compiler" );
        TypeDeclarationDescr typeDescr = new TypeDeclarationDescr( "StockTick" );
        typeDescr.addAnnotation( Role.class.getCanonicalName(), "Event" );
        typeDescr.addAnnotation( TypeSafe.class.getCanonicalName(), "true" );
        pkgDescr.addTypeDeclaration( typeDescr );

        KnowledgeBuilderImpl builder = new KnowledgeBuilderImpl();
        builder.addPackage( pkgDescr );
View Full Code Here

Examples of org.drools.compiler.lang.descr.TypeFieldDescr.addAnnotation()

        fldType.setObjectType( ( (FieldDefinition) fld ).getTypeName() );
        inheritedFldDescr.setPattern(fldType);
        if (fld.isKey()) {
            AnnotationDescr keyAnnotation = new AnnotationDescr(Key.class.getCanonicalName());
            keyAnnotation.setFullyQualifiedName(Key.class.getCanonicalName());
            inheritedFldDescr.addAnnotation(keyAnnotation);
        }
        inheritedFldDescr.setIndex(((FieldDefinition) fld).getDeclIndex());
        inheritedFldDescr.setInherited(true);

        String initExprOverride = ((FieldDefinition) fld).getInitExpr();
View Full Code Here

Examples of org.drools.core.factmodel.ClassDefinition.addAnnotation()

            if (annotation != null && annotation.isAnnotation() ) {
                try {
                    AnnotationDefinition annotationDefinition = AnnotationDefinition.build(annotation,
                            typeDescr.getAnnotations().get(annotationName).getValueMap(),
                            pkgRegistry.getTypeResolver());
                    def.addAnnotation(annotationDefinition);
                } catch (NoSuchMethodException nsme) {
                    this.results.add(new TypeDeclarationError(typeDescr,
                            "Annotated type " + fullName +
                                    "  - undefined property in @annotation " +
                                    annotationName + ": " +
View Full Code Here

Examples of org.drools.core.factmodel.FieldDefinition.addAnnotation()

                if (annotation != null && annotation.isAnnotation()) {
                    try {
                        AnnotationDefinition annotationDefinition = AnnotationDefinition.build( annotation,
                                                                                                field.getAnnotations().get( annotationName ).getValueMap(),
                                                                                                typeResolver );
                        fieldDef.addAnnotation( annotationDefinition );
                    } catch ( NoSuchMethodException nsme ) {

                        kbuilder.addBuilderResult( new TypeDeclarationError( field,
                                                                             "Annotated field " + field.getFieldName() +
                                                                             "  - undefined property in @annotation " +
View Full Code Here

Examples of org.drools.factmodel.ClassDefinition.addAnnotation()

                try {
                    AnnotationDefinition annotationDefinition = AnnotationDefinition.build(
                                                                                            annotation,
                                                                                            typeDescr.getAnnotations().get( annotationName ).getValueMap(),
                                                                                            pkgRegistry.getTypeResolver() );
                    def.addAnnotation( annotationDefinition );
                } catch ( NoSuchMethodException nsme ) {
                    this.results.add( new TypeDeclarationError( "Annotated type " + fullName + "  - undefined property in @annotation " + annotationName + ": " + nsme.getMessage() + ";",
                                                                typeDescr.getLine() ) );
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.