Examples of AnnotationDefinition


Examples of org.drools.core.factmodel.AnnotationDefinition

                     "end ";
        KieHelper helper = new KieHelper();
        helper.addContent( drl, ResourceType.DRL );

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        AnnotationDefinition adef = p.getAnnotations().get( Outer.class.getName().replace( "$", "." ) );

        assertEquals( String.class, adef.getPropertyValue( "klass" ) );
        assertEquals( Arrays.asList( new Class[] { String.class, Integer.class } ),
                      Arrays.asList( (Class[]) adef.getPropertyValue( "klasses" ) ) );

        assertNotNull( adef );

    }
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        Map<String,AnnotationDefinition> defs = p.getAnnotations();
        assertEquals( 1, defs.size() );

        AnnotationDefinition outer = defs.get( Outer.class.getName().replace( "$", "." ) );
        assertNotNull( outer );

        Object val = outer.getPropertyValue( "value" );
        assertNotNull( val );
        assertTrue( val instanceof AnnotationDefinition );

        AnnotationDefinition inner = (AnnotationDefinition) val;
        assertEquals( "world", inner.getPropertyValue( "text" ) );
    }
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        Map<String,AnnotationDefinition> defs = p.getAnnotations();
        assertEquals( 1, defs.size() );

        AnnotationDefinition outer = defs.get( Outer.class.getName().replace( "$", "." ) );
        assertNotNull( outer );

        Object val = outer.getPropertyValue( "values" );
        assertNotNull( val );
        assertTrue( val instanceof AnnotationDefinition[] );


    }
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

        Pattern p = ((Pattern) (( RuleImpl ) helper.build().getRule( "org.drools.test", "Foo" )).getLhs().getChildren().get( 0 ));
        Map<String,AnnotationDefinition> defs = p.getAnnotations();
        assertEquals( 1, defs.size() );

        AnnotationDefinition simple = defs.get( Simple.class.getName().replace( "$", "." ) );
        assertNotNull( simple );

        Object val = simple.getPropertyValue( "numbers" );
        assertTrue( val instanceof int[] );

    }
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

    protected void processMetadataAnnotations(Pattern pattern, Map<String, AnnotationDescr> annotationMap) {
        for ( String key : annotationMap.keySet() ) {
            if ( ! Pattern.ATTR_LISTENED_PROPS.equals( key ) ) {
                AnnotationDescr ann = annotationMap.get( key );
                AnnotationDefinition def = new AnnotationDefinition( key );
                for ( String propKey : ann.getValues().keySet() ) {
                    def.getValues().put( propKey, new AnnotationDefinition.AnnotationPropertyVal( propKey, null, ann.getValue( propKey ), null ) );
                }
                pattern.getAnnotations().put( key, def );
            }
        }       
    }
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

        for ( String annotationName : typeDescr.getAnnotationNames() ) {
            Class annotation = TypeDeclarationUtils.resolveAnnotation( annotationName,
                                                                       resolver );
            if ( annotation != null && annotation.isAnnotation() ) {
                try {
                    AnnotationDefinition annotationDefinition = AnnotationDefinition.build( annotation,
                                                                                            typeDescr.getAnnotations().get(annotationName).getValueMap(),
                                                                                            resolver );
                    def.addAnnotation(annotationDefinition);
                } catch (NoSuchMethodException nsme) {
                    kbuilder.addBuilderResult(new TypeDeclarationError(typeDescr,
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

            for (String annotationName : field.getAnnotationNames()) {
                Class annotation = TypeDeclarationUtils.resolveAnnotation( annotationName,
                                                                           typeResolver );
                if (annotation != null && annotation.isAnnotation()) {
                    try {
                        AnnotationDefinition annotationDefinition = AnnotationDefinition.build( annotation,
                                                                                                field.getAnnotations().get( annotationName ).getValueMap(),
                                                                                                typeResolver );
                        fieldDef.addAnnotation( annotationDefinition );
                    } catch ( NoSuchMethodException nsme ) {
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

    protected void processMetadataAnnotations(Pattern pattern, Map<String, AnnotationDescr> annotationMap) {
        for ( String key : annotationMap.keySet() ) {
            if ( ! Pattern.ATTR_LISTENED_PROPS.equals( key ) ) {
                AnnotationDescr ann = annotationMap.get( key );
                AnnotationDefinition def = new AnnotationDefinition( key );
                for ( String propKey : ann.getValues().keySet() ) {
                    def.getValues().put( propKey, new AnnotationDefinition.AnnotationPropertyVal( propKey, null, ann.getValue( propKey ), null ) );
                }
                pattern.getAnnotations().put( key, def );
            }
        }       
    }
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

        for (String annotationName : typeDescr.getAnnotationNames()) {
            Class annotation = resolveAnnotation(annotationName,
                    pkgRegistry.getTypeResolver());
            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,
View Full Code Here

Examples of org.drools.core.factmodel.AnnotationDefinition

                for (String annotationName : field.getAnnotationNames()) {
                    Class annotation = resolveAnnotation(annotationName,
                            pkgRegistry.getTypeResolver());
                    if (annotation != null && annotation.isAnnotation() ) {
                        try {
                            AnnotationDefinition annotationDefinition = AnnotationDefinition.build(annotation,
                                    field.getAnnotations().get(annotationName).getValueMap(),
                                    pkgRegistry.getTypeResolver());
                            fieldDef.addAnnotation(annotationDefinition);
                        } catch (NoSuchMethodException nsme) {
                            this.results.add(new TypeDeclarationError(field,
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.