/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */
package instrumentj.impl;


import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

/**
 * @author Stephen Evanchik (evanchsa@gmail.com)
 *
 */
public class InstrumentClassVisitor extends ClassVisitor {

    private final String className;

    /**
     *
     * @param cv
     * @param className
     */
    public InstrumentClassVisitor(final ClassVisitor cv, final String className) {
        super(Opcodes.ASM4, cv);

        if (className == null) {
            throw new NullPointerException("className");
        }

        this.className = className;
    }

    @Override
    public MethodVisitor visitMethod(
            final int access,
            final String name,
            final String desc,
            final String signature,
            final String[] exceptions)
    {
        final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
        return new InstrumentMethodVisitor(className, mv, access, name, desc);
    }

    @Override
    public String toString() {
        return super.toString() + " for " + className;
    }
}

@@ -589,16 +589,91 @@
 impl;%0A%0A%0A
+import instrumentj.Constants;%0A%0Aimport org.objectweb.asm.AnnotationVisitor;%0A
 import o
@@ -695,32 +695,32 @@
 m.ClassVisitor;%0A
-
 import org.objec
@@ -935,16 +935,51 @@
 sName;%0A%0A
+    private boolean excludeClass;%0A%0A
     /**%0A
@@ -1287,32 +1287,284 @@
 assName;%0A    %7D%0A%0A
+    @Override%0A    public AnnotationVisitor visitAnnotation(String desc, boolean visible) %7B%0A        if (Constants.EXCLUDE_ANNOTATION.equals(desc)) %7B%0A            excludeClass = true;%0A        %7D%0A%0A        return super.visitAnnotation(desc, visible);%0A    %7D%0A%0A
     @Override%0A  
@@ -1867,16 +1867,88 @@
 tions);%0A
+        if (excludeClass) %7B%0A            return mv;%0A        %7D else %7B%0A    
         
@@ -2018,16 +2018,26 @@
  desc);%0A
+        %7D%0A
     %7D%0A%0A 

Add Exclude annotation processing