Examples of AnnotationDescr


Examples of org.drools.lang.descr.AnnotationDescr

    }

    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.lang.descr.AnnotationDescr

    protected void processListenedPropertiesAnnotation(RuleBuildContext context,
                                                     PatternDescr patternDescr,
                                                     Pattern pattern,
                                                     Map<String, AnnotationDescr> annotationMap) {
        AnnotationDescr listenedProps = annotationMap.get(Pattern.ATTR_LISTENED_PROPS);
        if (listenedProps != null) {
            List<String> settableProperties = getSettableProperties(context, patternDescr, pattern);

            List<String> listenedProperties = new ArrayList<String>();
            for (String propertyName : listenedProps.getValue().toString().split(",")) {
                propertyName = propertyName.trim();
                if (propertyName.equals("*") || propertyName.equals("!*")) {
                    if (listenedProperties.contains("*") || listenedProperties.contains("!*")) {
                        context.addError( new DescrBuildError( context.getParentDescr(),
                                patternDescr,
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

    }

    public void buildMetaAttributes(final RuleBuildContext context ) {
        Rule rule = context.getRule();
        for ( String metaAttr : context.getRuleDescr().getAnnotationNames() ) {
            AnnotationDescr ad = context.getRuleDescr().getAnnotation( metaAttr );
            if ( ad.hasValue() ) {
                if ( ad.getValues().size() == 1 ) {
                    rule.addMetaAttribute( metaAttr,
                                           resolveValue( ad.getSingleValue() ) );
                } else {
                    rule.addMetaAttribute( metaAttr,
                                           ad.getValueMap() );
                }
            } else {
                rule.addMetaAttribute( metaAttr,
                                       null );
            }
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

        buildSalience( context );

        buildEnabled( context );
       
        AnnotationDescr ann = ruleDescr.getAnnotation( "activationListener" );
        if ( ann != null && !StringUtils.isEmpty( (String) ann.getValue() ) ) {
            rule.setActivationListener( MVEL.evalToString( (String) ann.getValue() ) );
        }

        //        buildDuration( context );
    }
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

        BaseDescr result = null;

        Token lop=null;
        BaseDescr left = null;

        AnnotationDescr args = null;

        BaseDescr right = null;


        try {
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr


    // $ANTLR start "fullAnnotation"
    // src/main/resources/org/drools/lang/DRLExpressions.g:180:1: fullAnnotation[AnnotatedDescrBuilder inDescrBuilder] returns [AnnotationDescr result] : AT name= ID ( DOT x= ID )* annotationArgs[result] ;
    public final AnnotationDescr fullAnnotation(AnnotatedDescrBuilder inDescrBuilder) throws RecognitionException {
        AnnotationDescr result = null;

        Token name=null;
        Token x=null;

         String n = "";
        try {
            // src/main/resources/org/drools/lang/DRLExpressions.g:182:3: ( AT name= ID ( DOT x= ID )* annotationArgs[result] )
            // src/main/resources/org/drools/lang/DRLExpressions.g:182:5: AT name= ID ( DOT x= ID )* annotationArgs[result]
            {
            match(input,AT,FOLLOW_AT_in_fullAnnotation885); if (state.failed) return result;
            name=(Token)match(input,ID,FOLLOW_ID_in_fullAnnotation889); if (state.failed) return result;
            if ( state.backtracking==0 ) {
               n = (name!=null?name.getText():null);
            }
            // src/main/resources/org/drools/lang/DRLExpressions.g:182:36: ( DOT x= ID )*
            loop18:
            do {
                int alt18=2;
                int LA18_0 = input.LA(1);

                if ( (LA18_0==DOT) ) {
                    alt18=1;
                }


                switch (alt18) {
              case 1 :
                  // src/main/resources/org/drools/lang/DRLExpressions.g:182:38: DOT x= ID
                  {
                  match(input,DOT,FOLLOW_DOT_in_fullAnnotation895); if (state.failed) return result;
                  x=(Token)match(input,ID,FOLLOW_ID_in_fullAnnotation899); if (state.failed) return result;
                  if ( state.backtracking==0 ) {
                     n += "." + (x!=null?x.getText():null);
                  }

                  }
                  break;

              default :
                  break loop18;
                }
            } while (true);

            if ( state.backtracking==0 ) {
               if( buildDescr ) { result = inDescrBuilder != null ? (AnnotationDescr) inDescrBuilder.newAnnotation( n ).getDescr() : new AnnotationDescr( n ); }
            }
            pushFollow(FOLLOW_annotationArgs_in_fullAnnotation920);
            annotationArgs(result);

            state._fsp--;
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

    public final BaseDescr conditionalOrExpression() throws RecognitionException {
        BaseDescr result = null;

        BaseDescr left = null;

        AnnotationDescr args = null;

        BaseDescr right = null;


        try {
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

    public final BaseDescr conditionalAndExpression() throws RecognitionException {
        BaseDescr result = null;

        BaseDescr left = null;

        AnnotationDescr args = null;

        BaseDescr right = null;


        try {
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

        BaseDescr result = null;

        Token lop=null;
        BaseDescr left = null;

        AnnotationDescr args = null;

        BaseDescr right = null;


        try {
View Full Code Here

Examples of org.drools.lang.descr.AnnotationDescr

        // multiple values with no keys are parsed as a single value
        final String text = "rule X @ann1( val1, val2 ) @ann2( \"val1\", \"val2\" ) when then end";
        RuleDescr rule = (RuleDescr) parse( "rule",
                                             text );

        AnnotationDescr ann = rule.getAnnotation( "ann1" );
        assertNotNull( ann );
        assertEquals( "val1, val2",
                      ann.getValue() );

        ann = rule.getAnnotation( "ann2" );
        assertNotNull( ann );
        assertEquals( "\"val1\", \"val2\"",
                      ann.getValue() );
    }
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.