@@ -0,0 +1,3935 @@
+/*%0A * Copyright 2017 NAVER Corp.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.navercorp.pinpoint.bootstrap.plugin.util;%0A%0Aimport com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass;%0Aimport com.navercorp.pinpoint.bootstrap.instrument.InstrumentException;%0Aimport com.navercorp.pinpoint.bootstrap.instrument.InstrumentMethod;%0Aimport com.navercorp.pinpoint.bootstrap.instrument.NotFoundInstrumentException;%0Aimport com.navercorp.pinpoint.bootstrap.interceptor.scope.ExecutionPolicy;%0A%0Aimport java.util.Arrays;%0A%0A/**%0A * @author Woonduk Kang(emeroad)%0A */%0Apublic final class InstrumentUtils %7B%0A%0A    public static void addInterceptor(InstrumentClass clazz, String methodName, String%5B%5D parameterTypes, String interceptorClassName, String scopeName) throws InstrumentException %7B%0A        addInterceptor(clazz, methodName, parameterTypes, interceptorClassName, scopeName, null);%0A    %7D%0A%0A    public static void addInterceptor(InstrumentClass clazz, String methodName, String%5B%5D parameterTypes, String interceptorClassName, String scopeName, ExecutionPolicy executionPolicy) throws InstrumentException %7B%0A        if (clazz == null) %7B%0A            throw new NullPointerException(%22clazz must not be null%22);%0A        %7D%0A        if (methodName == null) %7B%0A            throw new NullPointerException(%22methodName must not be null%22);%0A        %7D%0A        if (interceptorClassName == null) %7B%0A            throw new NullPointerException(%22interceptorClassName must not be null%22);%0A        %7D%0A        if (scopeName == null) %7B%0A            throw new NullPointerException(%22scopeName must not be null%22);%0A        %7D%0A%0A        final InstrumentMethod method = clazz.getDeclaredMethod(methodName, parameterTypes);%0A        if (method == null) %7B%0A            throw new NotFoundInstrumentException(%22Cannot find method %22 + methodName + %22 with parameter types: %22 + Arrays.toString(parameterTypes));%0A        %7D%0A        method.addScopedInterceptor(interceptorClassName, scopeName, executionPolicy);%0A    %7D%0A%0A    public static  void addInterceptor(InstrumentClass clazz, String methodName, String%5B%5D parameterTypes, String interceptorClassName, Object%5B%5D interceptorParams, String scopeName) throws InstrumentException %7B%0A        addInterceptor(clazz, methodName, parameterTypes, interceptorClassName, interceptorParams, scopeName, null);%0A    %7D%0A%0A    public static void addInterceptor(InstrumentClass clazz, String methodName, String%5B%5D parameterTypes, String interceptorClassName, Object%5B%5D interceptorParams, String scopeName, ExecutionPolicy executionPolicy) throws InstrumentException %7B%0A        if (clazz == null) %7B%0A            throw new NullPointerException(%22clazz must not be null%22);%0A        %7D%0A        if (methodName == null) %7B%0A            throw new NullPointerException(%22methodName must not be null%22);%0A        %7D%0A        if (interceptorClassName == null) %7B%0A            throw new NullPointerException(%22interceptorClassName must not be null%22);%0A        %7D%0A        if (scopeName == null) %7B%0A            throw new NullPointerException(%22scopeName must not be null%22);%0A        %7D%0A%0A        final InstrumentMethod method = clazz.getDeclaredMethod(methodName, parameterTypes);%0A        if (method == null) %7B%0A            throw new NotFoundInstrumentException(%22Cannot find method %22 + methodName + %22 with parameter types: %22 + Arrays.toString(parameterTypes));%0A        %7D%0A        method.addScopedInterceptor(interceptorClassName, interceptorParams, scopeName, executionPolicy);%0A    %7D%0A%7D%0A

Add InstrumentUtils