Package org.drools.compiler.lang.descr

Examples of org.drools.compiler.lang.descr.AnnotationDescr


        }

        Declaration[] declarations = new Declaration[ params.length ];

        if ( query.isAbductive() ) {
            AnnotationDescr ann = queryDescr.getAnnotation( Abductive.class.getSimpleName() );
            String returnName = ann.getValue( "target" );
            try {
                Class<?> returnKlass = context.getPkg().getTypeResolver().resolveType( returnName.replace( ".class", "" ) );
                ClassObjectType objectType = new ClassObjectType( returnKlass, false );
                objectType = context.getPkg().getClassFieldAccessorStore().getClassObjectType( objectType,
                                                                                               (AbductiveQuery) query );
View Full Code Here



  // $ANTLR start "fullAnnotation"
  // src/main/resources/org/drools/compiler/lang/DRL6Expressions.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/compiler/lang/DRL6Expressions.g:182:3: ( AT name= ID ( DOT x= ID )* annotationArgs[result] )
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:182:5: AT name= ID ( DOT x= ID )* annotationArgs[result]
      {
      match(input,AT,FOLLOW_AT_in_fullAnnotation894); if (state.failed) return result;
      name=(Token)match(input,ID,FOLLOW_ID_in_fullAnnotation898); if (state.failed) return result;
      if ( state.backtracking==0 ) { n = (name!=null?name.getText():null); }
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:182:36: ( DOT x= ID )*
      loop18:
      while (true) {
        int alt18=2;
        int LA18_0 = input.LA(1);
        if ( (LA18_0==DOT) ) {
          alt18=1;
        }

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

        default :
          break loop18;
        }
      }

      if ( state.backtracking==0 ) { if( buildDescr ) { result = inDescrBuilder != null ? (AnnotationDescr) inDescrBuilder.newAnnotation( n ).getDescr() : new AnnotationDescr( n ); } }
      pushFollow(FOLLOW_annotationArgs_in_fullAnnotation929);
      annotationArgs(result);
      state._fsp--;
      if (state.failed) return result;
      }
View Full Code Here

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


    BaseDescr left =null;
    AnnotationDescr args =null;
    BaseDescr right =null;

    try {
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:215:3: (left= conditionalAndExpression ( DOUBLE_PIPE (args= fullAnnotation[null] )? right= conditionalAndExpression )* )
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:215:5: left= conditionalAndExpression ( DOUBLE_PIPE (args= fullAnnotation[null] )? right= conditionalAndExpression )*
 
View Full Code Here

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


    BaseDescr left =null;
    AnnotationDescr args =null;
    BaseDescr right =null;

    try {
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:231:3: (left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )* )
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:231:5: left= inclusiveOrExpression ( DOUBLE_AMPER (args= fullAnnotation[null] )? right= inclusiveOrExpression )*
 
View Full Code Here

    BaseDescr result = null;


    Token lop=null;
    BaseDescr left =null;
    AnnotationDescr args =null;
    BaseDescr right =null;

    try {
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:392:3: (left= andRestriction ( ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction )* ( EOF )? )
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:392:5: left= andRestriction ( ( DOUBLE_PIPE ( fullAnnotation[null] )? andRestriction )=>lop= DOUBLE_PIPE (args= fullAnnotation[null] )? right= andRestriction )* ( EOF )?
View Full Code Here

    BaseDescr result = null;


    Token lop=null;
    BaseDescr left =null;
    AnnotationDescr args =null;
    BaseDescr right =null;

    try {
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:406:3: (left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )* )
      // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:406:5: left= singleRestriction ( ( DOUBLE_AMPER ( fullAnnotation[null] )? operator )=>lop= DOUBLE_AMPER (args= fullAnnotation[null] )? right= singleRestriction )*
 
View Full Code Here

                                                                this.buildStack);
        this.declarationResolver.setPackage(pkg);
        this.ruleDescr = ruleDescr;

        if ( ruleDescr instanceof QueryDescr ) {
            AnnotationDescr abductive = ruleDescr.getAnnotation( Abductive.class.getSimpleName() );
            if ( abductive == null ) {
                this.rule = new QueryImpl( ruleDescr.getName() );
            } else {
                this.rule = new AbductiveQuery( ruleDescr.getName(), abductive.getValue( "mode" ) );
            }
        } else {
            this.rule = new RuleImpl(ruleDescr.getName());
        }
        this.rule.setPackage(pkg.getName());
View Full Code Here

    }

    public void buildMetaAttributes(final RuleBuildContext context ) {
        RuleImpl 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

        buildSalience( context );

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

        ann = ruleDescr.getAnnotation( "Eager" );
        if ( enforceEager || ( ann != null && trueOrDefault( ann.getSingleValue() ) ) ) {
            rule.setEager( true );
        }

        ann = ruleDescr.getAnnotation( "Direct" );
        if ( ann != null && trueOrDefault( ann.getSingleValue() ) ) {
            rule.setActivationListener( "direct" );
        }

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

            fldType.setObjectType(((FieldDefinition) fld).getFieldAccessor().getExtractToClassName());
        }
        inheritedFldDescr.setPattern(fldType);
        if (fld.isKey()) {
            inheritedFldDescr.getAnnotations().put(TypeDeclaration.ATTR_KEY,
                                                   new AnnotationDescr(TypeDeclaration.ATTR_KEY));
        }
        inheritedFldDescr.setIndex(((FieldDefinition) fld).getDeclIndex());
        inheritedFldDescr.setInherited(true);

        String initExprOverride = ((FieldDefinition) fld).getInitExpr();
        int overrideCount = 0;
        // only @aliasing local fields may override defaults.
        for (TypeFieldDescr localField : typeDescr.getFields().values()) {
            AnnotationDescr ann = localField.getAnnotation("Alias");
            if (ann != null && fld.getName().equals(ann.getSingleValue().replaceAll("\"", "")) && localField.getInitExpr() != null) {
                overrideCount++;
                initExprOverride = localField.getInitExpr();
            }
        }
        if (overrideCount > 1) {
View Full Code Here

TOP

Related Classes of org.drools.compiler.lang.descr.AnnotationDescr

Copyright © 2018 www.massapicom. 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.