2 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.hc2vpp.docs.core;
21 import org.objectweb.asm.ClassVisitor;
22 import org.objectweb.asm.MethodVisitor;
23 import org.objectweb.asm.Opcodes;
25 public class MethodDelegatingClassVisitor extends ClassVisitor {
27 private final String currentClass;
28 private final String methodName;
29 private final String reference;
30 private final Set<PluginMethodReference> foundReferences;
31 private final Set<String> allreadyProcessedLocalMethods;
33 public MethodDelegatingClassVisitor(String currentClass,
36 Set<PluginMethodReference> foundReferences,
37 Set<String> allreadyProcessedLocalMethods) {
39 this.currentClass = currentClass;
40 this.methodName = methodName;
41 this.reference = reference;
42 this.foundReferences = foundReferences;
43 this.allreadyProcessedLocalMethods = allreadyProcessedLocalMethods;
47 public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
48 if (name.equals(methodName)) {
49 return new MethodPluginCoverageVisitor(currentClass, foundReferences, reference,
50 allreadyProcessedLocalMethods);
52 return super.visitMethod(access, name, desc, signature, exceptions);