private void bindVariableIntercept(
     InstrumentClass preparedStatement, ClassLoader classLoader, ProtectionDomain protectedDomain)
     throws InstrumentException {
   List<Method> bindMethod = PreparedStatementUtils.findBindVariableSetMethod();
   final Scope scope = byteCodeInstrumentor.getScope(JtdsScope.SCOPE_NAME);
   Interceptor interceptor =
       new ScopeDelegateStaticInterceptor(new PreparedStatementBindVariableInterceptor(), scope);
   int interceptorId = -1;
   for (Method method : bindMethod) {
     String methodName = method.getName();
     String[] parameterType = JavaAssistUtils.getParameterType(method.getParameterTypes());
     try {
       if (interceptorId == -1) {
         interceptorId = preparedStatement.addInterceptor(methodName, parameterType, interceptor);
       } else {
         preparedStatement.reuseInterceptor(methodName, parameterType, interceptorId);
       }
     } catch (NotFoundInstrumentException e) {
       // Cannot find bind variable setter method. This is not an error. logging will be enough.
       if (logger.isDebugEnabled()) {
         logger.debug(
             "bindVariable api not found. method:{} param:{} Cause:{}",
             methodName,
             Arrays.toString(parameterType),
             e.getMessage());
       }
     }
   }
 }
  public byte[] modify(
      ClassLoader classLoader,
      String javassistClassName,
      ProtectionDomain protectedDomain,
      byte[] classFileBuffer) {
    if (logger.isInfoEnabled()) {
      logger.info("Modifing. {}", javassistClassName);
    }
    try {
      InstrumentClass preparedStatementClass =
          byteCodeInstrumentor.getClass(classLoader, javassistClassName, classFileBuffer);

      Interceptor executeInterceptor = new PreparedStatementExecuteQueryInterceptor();
      preparedStatementClass.addScopeInterceptor(
          "execute", null, executeInterceptor, JtdsScope.SCOPE_NAME);

      Interceptor executeQueryInterceptor = new PreparedStatementExecuteQueryInterceptor();
      preparedStatementClass.addScopeInterceptor(
          "executeQuery", null, executeQueryInterceptor, JtdsScope.SCOPE_NAME);

      Interceptor executeUpdateInterceptor = new PreparedStatementExecuteQueryInterceptor();
      preparedStatementClass.addScopeInterceptor(
          "executeUpdate", null, executeUpdateInterceptor, JtdsScope.SCOPE_NAME);

      preparedStatementClass.addTraceValue(DatabaseInfoTraceValue.class);
      preparedStatementClass.addTraceValue(ParsingResultTraceValue.class);
      preparedStatementClass.addTraceValue(BindValueTraceValue.class, "new java.util.HashMap();");

      bindVariableIntercept(preparedStatementClass, classLoader, protectedDomain);

      return preparedStatementClass.toBytecode();
    } catch (InstrumentException e) {
      if (logger.isWarnEnabled()) {
        logger.warn("{} modify fail. Cause:{}", this.getClass().getSimpleName(), e.getMessage(), e);
      }
      return null;
    }
  }