Coverage Report - org.boretti.drools.integration.drools5.DroolsCheckFieldVisitor
 
Classes in this File Line Coverage Branch Coverage Complexity
DroolsCheckFieldVisitor
0 %
0/10
0 %
0/4
2
 
 1  
 /*
 2  
     Drools5 Integration Helper
 3  
     Copyright (C) 2009  Mathieu Boretti mathieu.boretti@gmail.com
 4  
 
 5  
     This program is free software: you can redistribute it and/or modify
 6  
     it under the terms of the GNU General Public License as published by
 7  
     the Free Software Foundation, either version 3 of the License, or
 8  
     (at your option) any later version.
 9  
 
 10  
     This program is distributed in the hope that it will be useful,
 11  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
     GNU General Public License for more details.
 14  
 
 15  
     You should have received a copy of the GNU General Public License
 16  
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 17  
 
 18  
  */
 19  
 package org.boretti.drools.integration.drools5;
 20  
 
 21  
 import org.apache.maven.plugin.logging.Log;
 22  
 import org.boretti.drools.integration.drools5.annotations.DroolsGenerated;
 23  
 import org.boretti.drools.integration.drools5.annotations.DroolsIgnored;
 24  
 import org.objectweb.asm.AnnotationVisitor;
 25  
 import org.objectweb.asm.FieldVisitor;
 26  
 import org.objectweb.asm.Type;
 27  
 import org.objectweb.asm.util.CheckFieldAdapter;
 28  
 
 29  
 /**
 30  
  * @author mbo
 31  
  *
 32  
  */
 33  
 class DroolsCheckFieldVisitor extends CheckFieldAdapter {
 34  
         
 35  
         private DroolsClassVisitor visitor;
 36  
         
 37  
         private Log logger;
 38  
         
 39  
         private String fieldName;
 40  
 
 41  
         public DroolsCheckFieldVisitor(Log logger,FieldVisitor parent,DroolsClassVisitor visitor,String fieldName) {
 42  0
                 super(parent);
 43  0
                 this.visitor=visitor;
 44  0
                 this.logger=logger;
 45  0
                 this.fieldName=fieldName;
 46  0
         }
 47  
 
 48  
         /* (non-Javadoc)
 49  
          * @see org.objectweb.asm.util.CheckFieldAdapter#visitAnnotation(java.lang.String, boolean)
 50  
          */
 51  
         @Override
 52  
         public AnnotationVisitor visitAnnotation(String name, boolean arg1) {
 53  0
                 if (Type.getType(name).getClassName().equals(Type.getType(DroolsGenerated.class).getClassName())) {
 54  0
                         visitor.getFieldType().put(fieldName.toUpperCase(), (byte)0);
 55  0
                 } else if (Type.getType(name).getClassName().equals(Type.getType(DroolsIgnored.class).getClassName())) {
 56  0
                         visitor.getFieldType().put(fieldName.toUpperCase(), (byte)1);
 57  
                 }
 58  0
                 return super.visitAnnotation(name, arg1);
 59  
         }
 60  
 
 61  
 }