diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java
index 01f77c835..8a4a0a9fe 100644
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/EnhanceClazz4Interceptor.java
@@ -116,11 +116,11 @@ public class EnhanceClazz4Interceptor {
FieldGetter.class,
FieldSetter.class))));
- MethodNameMatcher[] methodMatchers = define.getBeInterceptedMethodsMatchers();
+ MethodMatcher[] methodMatchers = define.getBeInterceptedMethodsMatchers();
ClassMethodInterceptor classMethodInterceptor = new ClassMethodInterceptor(
interceptor);
- for (MethodNameMatcher methodMatcher : methodMatchers) {
+ for (MethodMatcher methodMatcher : methodMatchers) {
logger.debug("prepare to enhance class {} method [{}] ",
enhanceOriginClassName, methodMatcher.getMethodMatchDescribe());
newClassBuilder = newClassBuilder.method(
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/InterceptorDefine.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/InterceptorDefine.java
index e6dcdd1cd..5bd87b79d 100644
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/InterceptorDefine.java
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/InterceptorDefine.java
@@ -13,7 +13,7 @@ public interface InterceptorDefine {
*
* @return
*/
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers();
+ public MethodMatcher[] getBeInterceptedMethodsMatchers();
/**
* 返回增强拦截器的实现
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodMatcher.java
new file mode 100644
index 000000000..a9d414eea
--- /dev/null
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodMatcher.java
@@ -0,0 +1,93 @@
+package com.ai.cloud.skywalking.plugin.interceptor;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+import static net.bytebuddy.matcher.ElementMatchers.*;
+
+public abstract class MethodMatcher {
+
+ private String methodMatchDescribe;
+
+ private int argNum = -1;
+
+ private Class>[] argTypeArray;
+
+ private Modifier modifier;
+
+ public MethodMatcher(String methodMatchDescribe) {
+ this(null, methodMatchDescribe);
+ }
+
+ public MethodMatcher(Modifier modifier, String methodMatchDescribe) {
+ this.methodMatchDescribe = methodMatchDescribe;
+ this.modifier = modifier;
+ }
+
+
+ public MethodMatcher(String methodMatchDescribe, int argNum) {
+ this(null, methodMatchDescribe, argNum);
+ }
+
+ public MethodMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
+ this.methodMatchDescribe = methodMatchDescribe;
+ this.argNum = argNum;
+ this.modifier = modifier;
+ }
+
+ public MethodMatcher(String methodMatchDescribe, Class>[] argTypeArray) {
+ this(null, methodMatchDescribe, argTypeArray);
+ }
+
+ public MethodMatcher(Modifier modifier, String methodMatchDescribe, Class>[] argTypeArray) {
+ this.argTypeArray = argTypeArray;
+ this.methodMatchDescribe = methodMatchDescribe;
+ this.modifier = modifier;
+ }
+
+ public abstract ElementMatcher.Junction builderMatcher();
+
+ protected String getMethodMatchDescribe() {
+ return methodMatchDescribe;
+ }
+
+ protected ElementMatcher.Junction mergeArgumentsIfNecessary(ElementMatcher.Junction matcher) {
+ if (argTypeArray != null) {
+ matcher = matcher.and(takesArguments(argTypeArray));
+ }
+
+ if (argNum > -1) {
+ matcher = matcher.and(takesArguments(argNum));
+ }
+
+ if (modifier != null) {
+ matcher = matcher.and(modifier.elementMatcher());
+ }
+
+ return matcher;
+ }
+
+ public enum Modifier {
+ Public, Default, Private, Protected;
+
+ private ElementMatcher elementMatcher() {
+ switch (this) {
+ case Private: {
+ return isPrivate();
+ }
+ case Default: {
+ return isPackagePrivate();
+ }
+ case Public: {
+ return isPublic();
+ }
+ case Protected: {
+ return isProtected();
+ }
+ default:
+ return isPublic();
+ }
+ }
+ }
+
+}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodNameMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodNameMatcher.java
deleted file mode 100644
index 759f3e958..000000000
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/MethodNameMatcher.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.ai.cloud.skywalking.plugin.interceptor;
-
-import net.bytebuddy.description.method.MethodDescription;
-import net.bytebuddy.matcher.ElementMatcher;
-
-public abstract class MethodNameMatcher {
-
- private String methodMatchDescribe;
-
- private int argNum = -1;
-
- private Class>[] argTypeArray;
-
- public MethodNameMatcher(String methodMatchDescribe) {
- this.methodMatchDescribe = methodMatchDescribe;
- }
-
- public MethodNameMatcher(String methodMatchDescribe, int argNum) {
- this.methodMatchDescribe = methodMatchDescribe;
- this.argNum = argNum;
- }
-
- public MethodNameMatcher(String methodMatchDescribe, Class>[] argTypeArray) {
- this.argTypeArray = argTypeArray;
- this.methodMatchDescribe = methodMatchDescribe;
- }
-
- public abstract ElementMatcher builderMatcher();
-
- protected String getMethodMatchDescribe() {
- return methodMatchDescribe;
- }
-
- protected int getArgNum() {
- return argNum;
- }
-
- protected Class>[] getArgTypeArray() {
- return argTypeArray;
- }
-}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/AnyMethodMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/AnyMethodMatcher.java
index 682a5b12a..7ff417286 100644
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/AnyMethodMatcher.java
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/AnyMethodMatcher.java
@@ -1,19 +1,19 @@
package com.ai.cloud.skywalking.plugin.interceptor.matcher;
-import static net.bytebuddy.matcher.ElementMatchers.any;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.matcher.ElementMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
+import static net.bytebuddy.matcher.ElementMatchers.any;
-public class AnyMethodMatcher extends MethodNameMatcher {
+public class AnyMethodMatcher extends MethodMatcher {
public AnyMethodMatcher() {
super("*");
}
@Override
- public ElementMatcher builderMatcher() {
+ public ElementMatcher.Junction builderMatcher() {
return any();
}
}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/ExclusionNameMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/ExclusionNameMatcher.java
deleted file mode 100644
index 476df8340..000000000
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/ExclusionNameMatcher.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ai.cloud.skywalking.plugin.interceptor.matcher;
-
-import static net.bytebuddy.matcher.ElementMatchers.named;
-import static net.bytebuddy.matcher.ElementMatchers.not;
-import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
-import net.bytebuddy.description.method.MethodDescription;
-import net.bytebuddy.matcher.ElementMatcher;
-
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-
-public class ExclusionNameMatcher extends MethodNameMatcher {
-
- public ExclusionNameMatcher(String methodMatchDescribe) {
- super(methodMatchDescribe);
- }
-
- public ExclusionNameMatcher(String methodMatchDescribe, int argNum) {
- super(methodMatchDescribe, argNum);
- }
-
- public ExclusionNameMatcher(String methodMatchDescribe, Class>[] argTypeArray) {
- super(methodMatchDescribe, argTypeArray);
- }
-
- @Override
- public ElementMatcher builderMatcher() {
- ElementMatcher.Junction matcher = not(named(getMethodMatchDescribe()));
-
- if (getArgTypeArray() != null) {
- matcher.and(takesArguments(getArgTypeArray()));
- }
-
- if (getArgNum() > -1) {
- matcher.and(takesArguments(getArgNum()));
- }
-
- return matcher;
- }
-}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/FullNameMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/FullNameMatcher.java
deleted file mode 100644
index 76aca82e8..000000000
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/FullNameMatcher.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.ai.cloud.skywalking.plugin.interceptor.matcher;
-
-import static net.bytebuddy.matcher.ElementMatchers.named;
-import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
-import net.bytebuddy.description.method.MethodDescription;
-import net.bytebuddy.matcher.ElementMatcher;
-
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-
-public class FullNameMatcher extends MethodNameMatcher {
-
- public FullNameMatcher(String methodName) {
- super(methodName);
- }
-
- public FullNameMatcher(String methodName, int argNum) {
- super(methodName, argNum);
- }
-
- public FullNameMatcher(String methodName, Class>... args) {
- super(methodName, args);
- }
-
- @Override
- public ElementMatcher builderMatcher() {
- ElementMatcher.Junction matcher = named(getMethodMatchDescribe());
-
- if (getArgTypeArray() != null) {
- matcher.and(takesArguments(getArgTypeArray()));
- }
-
- if (getArgNum() > -1) {
- matcher.and(takesArguments(getArgNum()));
- }
-
- return matcher;
- }
-}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodExclusiveMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodExclusiveMatcher.java
new file mode 100644
index 000000000..5ea3cbb83
--- /dev/null
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodExclusiveMatcher.java
@@ -0,0 +1,41 @@
+package com.ai.cloud.skywalking.plugin.interceptor.matcher;
+
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.not;
+
+public class MethodExclusiveMatcher extends MethodMatcher {
+
+ public MethodExclusiveMatcher(String methodMatchDescribe) {
+ super(methodMatchDescribe);
+ }
+
+ public MethodExclusiveMatcher(String methodMatchDescribe, int argNum) {
+ super(methodMatchDescribe, argNum);
+ }
+
+ public MethodExclusiveMatcher(String methodMatchDescribe, Class>[] argTypeArray) {
+ super(methodMatchDescribe, argTypeArray);
+ }
+
+ public MethodExclusiveMatcher(Modifier modifier, String methodMatchDescribe) {
+ super(modifier, methodMatchDescribe);
+ }
+
+ public MethodExclusiveMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
+ super(modifier, methodMatchDescribe, argNum);
+ }
+
+ public MethodExclusiveMatcher(Modifier modifier, String methodMatchDescribe, Class>[] argTypeArray) {
+ super(modifier, methodMatchDescribe, argTypeArray);
+ }
+
+ @Override
+ public ElementMatcher.Junction builderMatcher() {
+ ElementMatcher.Junction matcher = named(getMethodMatchDescribe());
+ return not(mergeArgumentsIfNecessary(matcher));
+ }
+}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodRegexMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodRegexMatcher.java
new file mode 100644
index 000000000..047eba467
--- /dev/null
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodRegexMatcher.java
@@ -0,0 +1,41 @@
+package com.ai.cloud.skywalking.plugin.interceptor.matcher;
+
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+import static net.bytebuddy.matcher.ElementMatchers.nameMatches;
+
+public class MethodRegexMatcher extends MethodMatcher {
+
+ public MethodRegexMatcher(String methodMatchDescribe) {
+ super(methodMatchDescribe);
+ }
+
+ public MethodRegexMatcher(String methodMatchDescribe, int argNum) {
+ super(methodMatchDescribe, argNum);
+ }
+
+ public MethodRegexMatcher(String methodMatchDescribe, Class>[] argTypeArray) {
+ super(methodMatchDescribe, argTypeArray);
+ }
+
+ public MethodRegexMatcher(Modifier modifier, String methodMatchDescribe) {
+ super(modifier, methodMatchDescribe);
+ }
+
+ public MethodRegexMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
+ super(modifier, methodMatchDescribe, argNum);
+ }
+
+ public MethodRegexMatcher(Modifier modifier, String methodMatchDescribe, Class>[] argTypeArray) {
+ super(modifier, methodMatchDescribe, argTypeArray);
+ }
+
+
+ @Override
+ public ElementMatcher.Junction builderMatcher() {
+ ElementMatcher.Junction matcher = nameMatches(getMethodMatchDescribe());
+ return mergeArgumentsIfNecessary(matcher);
+ }
+}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodsExclusiveMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodsExclusiveMatcher.java
new file mode 100644
index 000000000..96e411bef
--- /dev/null
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/MethodsExclusiveMatcher.java
@@ -0,0 +1,49 @@
+package com.ai.cloud.skywalking.plugin.interceptor.matcher;
+
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static net.bytebuddy.matcher.ElementMatchers.not;
+
+/**
+ * Created by xin on 16-6-8.
+ */
+public class MethodsExclusiveMatcher extends MethodMatcher {
+
+ private List matchers = new ArrayList();
+
+ public MethodsExclusiveMatcher(String... methodNames) {
+ super("Exclusive method name: " + methodNames.toString());
+ for (String methodName : methodNames) {
+ matchers.add(new SimpleMethodMatcher(methodName));
+ }
+ }
+
+ public MethodsExclusiveMatcher(MethodMatcher... matchers) {
+ super("Exclusive methods description :" + matchers.toString());
+ this.matchers.addAll(Arrays.asList(matchers));
+ }
+
+ @Override
+ public ElementMatcher.Junction builderMatcher() {
+
+ ElementMatcher.Junction result = null;
+
+ for (MethodMatcher matcher : matchers) {
+ if (result == null) {
+ result = matcher.builderMatcher();
+ continue;
+ }
+
+ result = result.or(matcher.builderMatcher());
+ }
+
+ return not(result);
+ }
+
+}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/RegexNameMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/RegexNameMatcher.java
deleted file mode 100644
index 5723be32e..000000000
--- a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/RegexNameMatcher.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.ai.cloud.skywalking.plugin.interceptor.matcher;
-
-import static net.bytebuddy.matcher.ElementMatchers.nameMatches;
-import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
-import net.bytebuddy.description.method.MethodDescription;
-import net.bytebuddy.matcher.ElementMatcher;
-
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-
-public class RegexNameMatcher extends MethodNameMatcher {
-
- public RegexNameMatcher(String methodMatchDescribe) {
- super(methodMatchDescribe);
- }
-
- public RegexNameMatcher(String methodMatchDescribe, int argNum) {
- super(methodMatchDescribe, argNum);
- }
-
- public RegexNameMatcher(String methodMatchDescribe, Class>[] argTypeArray) {
- super(methodMatchDescribe, argTypeArray);
- }
-
- @Override
- public ElementMatcher builderMatcher() {
- ElementMatcher.Junction matcher = nameMatches(getMethodMatchDescribe());
-
- if (getArgTypeArray() != null) {
- matcher.and(takesArguments(getArgTypeArray()));
- }
-
- if (getArgNum() > -1) {
- matcher.and(takesArguments(getArgNum()));
- }
-
- return matcher;
- }
-}
diff --git a/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/SimpleMethodMatcher.java b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/SimpleMethodMatcher.java
new file mode 100644
index 000000000..612a48c1f
--- /dev/null
+++ b/skywalking-api/src/main/java/com/ai/cloud/skywalking/plugin/interceptor/matcher/SimpleMethodMatcher.java
@@ -0,0 +1,41 @@
+package com.ai.cloud.skywalking.plugin.interceptor.matcher;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+
+public class SimpleMethodMatcher extends com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher {
+
+ public SimpleMethodMatcher(String methodName) {
+ super(methodName);
+ }
+
+ public SimpleMethodMatcher(String methodName, int argNum) {
+ super(methodName, argNum);
+ }
+
+ public SimpleMethodMatcher(String methodName, Class>... args) {
+ super(methodName, args);
+ }
+
+
+ public SimpleMethodMatcher(Modifier modifier, String methodMatchDescribe) {
+ super(modifier, methodMatchDescribe);
+ }
+
+ public SimpleMethodMatcher(Modifier modifier, String methodMatchDescribe, int argNum) {
+ super(modifier, methodMatchDescribe, argNum);
+ }
+
+ public SimpleMethodMatcher(Modifier modifier, String methodMatchDescribe, Class>[] argTypeArray) {
+ super(modifier, methodMatchDescribe, argTypeArray);
+ }
+
+
+ @Override
+ public ElementMatcher.Junction builderMatcher() {
+ ElementMatcher.Junction matcher = named(getMethodMatchDescribe());
+ return mergeArgumentsIfNecessary(matcher);
+ }
+}
diff --git a/skywalking-api/src/test/java/test/ai/cloud/matcher/ExclusionMatcherTest.java b/skywalking-api/src/test/java/test/ai/cloud/matcher/ExclusionMatcherTest.java
new file mode 100644
index 000000000..949dc0a91
--- /dev/null
+++ b/skywalking-api/src/test/java/test/ai/cloud/matcher/ExclusionMatcherTest.java
@@ -0,0 +1,18 @@
+package test.ai.cloud.matcher;
+
+import com.ai.cloud.skywalking.plugin.PluginBootstrap;
+
+public class ExclusionMatcherTest {
+
+
+ public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+ new PluginBootstrap().start();
+ TestMatcherClass testMatcherClass = (TestMatcherClass) Class.forName("test.ai.cloud.matcher.TestMatcherClass").newInstance();
+
+ testMatcherClass.set();
+ testMatcherClass.seta("a");
+ testMatcherClass.get("a");
+ testMatcherClass.find();
+ }
+
+}
diff --git a/skywalking-api/src/test/java/test/ai/cloud/matcher/TestAroundInterceptor.java b/skywalking-api/src/test/java/test/ai/cloud/matcher/TestAroundInterceptor.java
new file mode 100644
index 000000000..e9c1019b9
--- /dev/null
+++ b/skywalking-api/src/test/java/test/ai/cloud/matcher/TestAroundInterceptor.java
@@ -0,0 +1,32 @@
+package test.ai.cloud.matcher;
+
+import com.ai.cloud.skywalking.plugin.interceptor.ConstructorInvokeContext;
+import com.ai.cloud.skywalking.plugin.interceptor.EnhancedClassInstanceContext;
+import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodInvokeContext;
+
+/**
+ * Created by xin on 16-6-8.
+ */
+public class TestAroundInterceptor implements IAroundInterceptor {
+ @Override
+ public void onConstruct(EnhancedClassInstanceContext context, ConstructorInvokeContext interceptorContext) {
+
+ }
+
+ @Override
+ public void beforeMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext) {
+ System.out.println("before method");
+ }
+
+ @Override
+ public Object afterMethod(EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) {
+ System.out.println("after method");
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(Throwable t, EnhancedClassInstanceContext context, MethodInvokeContext interceptorContext, Object ret) {
+
+ }
+}
diff --git a/skywalking-api/src/test/java/test/ai/cloud/matcher/TestMatcherClass.java b/skywalking-api/src/test/java/test/ai/cloud/matcher/TestMatcherClass.java
new file mode 100644
index 000000000..9a72887c6
--- /dev/null
+++ b/skywalking-api/src/test/java/test/ai/cloud/matcher/TestMatcherClass.java
@@ -0,0 +1,28 @@
+package test.ai.cloud.matcher;
+
+/**
+ * Created by xin on 16-6-8.
+ */
+public class TestMatcherClass {
+
+ public void set() {
+ System.out.println("set()");
+ }
+
+ public void seta(String a) {
+ set(a);
+ }
+
+ private void set(String a) {
+ System.out.println("set(String a)");
+ }
+
+ public void get(String a) {
+ System.out.println("get(String a)");
+ }
+
+ public void find() {
+ System.out.println("find()");
+ }
+
+}
diff --git a/skywalking-api/src/test/java/test/ai/cloud/matcher/TestMatcherDefine.java b/skywalking-api/src/test/java/test/ai/cloud/matcher/TestMatcherDefine.java
new file mode 100644
index 000000000..6af67b91e
--- /dev/null
+++ b/skywalking-api/src/test/java/test/ai/cloud/matcher/TestMatcherDefine.java
@@ -0,0 +1,30 @@
+package test.ai.cloud.matcher;
+
+import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
+import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.MethodsExclusiveMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
+
+/**
+ * Created by xin on 16-6-8.
+ */
+public class TestMatcherDefine implements InterceptorDefine {
+ @Override
+ public String getBeInterceptedClassName() {
+ return "test.ai.cloud.matcher.TestMatcherClass";
+ }
+
+ @Override
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[]{
+ new MethodsExclusiveMatcher("set", "get"),
+ new SimpleMethodMatcher(MethodMatcher.Modifier.Private, "set")
+ };
+ }
+
+ @Override
+ public IAroundInterceptor instance() {
+ return new TestAroundInterceptor();
+ }
+}
diff --git a/skywalking-api/src/test/java/test/ai/cloud/plugin/TestInterceptorDefine.java b/skywalking-api/src/test/java/test/ai/cloud/plugin/TestInterceptorDefine.java
index bdfaf0305..a84ae48a3 100644
--- a/skywalking-api/src/test/java/test/ai/cloud/plugin/TestInterceptorDefine.java
+++ b/skywalking-api/src/test/java/test/ai/cloud/plugin/TestInterceptorDefine.java
@@ -2,8 +2,8 @@ package test.ai.cloud.plugin;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class TestInterceptorDefine implements InterceptorDefine {
@@ -13,8 +13,8 @@ public class TestInterceptorDefine implements InterceptorDefine {
}
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[] { new FullNameMatcher("printabc") };
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[] { new SimpleMethodMatcher("printabc") };
}
@Override
diff --git a/skywalking-sdk-plugin/httpClient-4.x-plugin-dubbox-rest-attachment/src/main/java/org/skywalking/httpClient/v4/plugin/dubbox/rest/attachment/DubboxRestHeadSetterAttachment.java b/skywalking-sdk-plugin/httpClient-4.x-plugin-dubbox-rest-attachment/src/main/java/org/skywalking/httpClient/v4/plugin/dubbox/rest/attachment/DubboxRestHeadSetterAttachment.java
index 48881e5fa..3cc30cb9b 100644
--- a/skywalking-sdk-plugin/httpClient-4.x-plugin-dubbox-rest-attachment/src/main/java/org/skywalking/httpClient/v4/plugin/dubbox/rest/attachment/DubboxRestHeadSetterAttachment.java
+++ b/skywalking-sdk-plugin/httpClient-4.x-plugin-dubbox-rest-attachment/src/main/java/org/skywalking/httpClient/v4/plugin/dubbox/rest/attachment/DubboxRestHeadSetterAttachment.java
@@ -4,7 +4,7 @@ import org.skywalking.httpClient.v4.plugin.HttpClientExecuteInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
public class DubboxRestHeadSetterAttachment implements InterceptorDefine {
@@ -20,7 +20,7 @@ public class DubboxRestHeadSetterAttachment implements InterceptorDefine {
}
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
return null;
}
diff --git a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/AbstractHttpClientPluginDefine.java b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/AbstractHttpClientPluginDefine.java
index 5e393eeb6..6b43ad2d1 100644
--- a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/AbstractHttpClientPluginDefine.java
+++ b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/AbstractHttpClientPluginDefine.java
@@ -1,7 +1,7 @@
package org.skywalking.httpClient.v4.plugin.define;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class AbstractHttpClientPluginDefine extends HttpClientPluginDefine {
@@ -17,8 +17,8 @@ public class AbstractHttpClientPluginDefine extends HttpClientPluginDefine {
*
*/
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[] {
- new FullNameMatcher("doExecute")};
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[] {
+ new SimpleMethodMatcher("doExecute")};
}
}
diff --git a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/DefaultRequestDirectorPluginDefine.java b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/DefaultRequestDirectorPluginDefine.java
index 75e32dfc2..3197d6fd3 100644
--- a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/DefaultRequestDirectorPluginDefine.java
+++ b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/DefaultRequestDirectorPluginDefine.java
@@ -1,7 +1,7 @@
package org.skywalking.httpClient.v4.plugin.define;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class DefaultRequestDirectorPluginDefine extends HttpClientPluginDefine {
/**
@@ -15,9 +15,9 @@ public class DefaultRequestDirectorPluginDefine extends HttpClientPluginDefine {
}
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[] {
- new FullNameMatcher("execute")};
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[] {
+ new SimpleMethodMatcher("execute")};
}
}
diff --git a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/InternalHttpClientPluginDefine.java b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/InternalHttpClientPluginDefine.java
index 990c8f946..35612d41e 100644
--- a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/InternalHttpClientPluginDefine.java
+++ b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/InternalHttpClientPluginDefine.java
@@ -1,12 +1,12 @@
package org.skywalking.httpClient.v4.plugin.define;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class InternalHttpClientPluginDefine extends HttpClientPluginDefine {
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[]{new FullNameMatcher("doExecute")};
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[]{new SimpleMethodMatcher("doExecute")};
}
@Override
diff --git a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/MinimalHttpClientPluginDefine.java b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/MinimalHttpClientPluginDefine.java
index a0aa7750c..b7ff63272 100644
--- a/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/MinimalHttpClientPluginDefine.java
+++ b/skywalking-sdk-plugin/httpClient-4.x-plugin/src/main/java/org/skywalking/httpClient/v4/plugin/define/MinimalHttpClientPluginDefine.java
@@ -1,12 +1,12 @@
package org.skywalking.httpClient.v4.plugin.define;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class MinimalHttpClientPluginDefine extends HttpClientPluginDefine {
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[]{new FullNameMatcher("doExecute")};
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[]{new SimpleMethodMatcher("doExecute")};
}
@Override
diff --git a/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java b/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java
index 430444b69..1b9551972 100644
--- a/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java
+++ b/skywalking-sdk-plugin/jedis-2.x-plugin/src/main/java/org/skywalking/jedis/v2/plugin/define/JedisPluginDefine.java
@@ -4,7 +4,7 @@ import org.skywalking.jedis.v2.plugin.JedisInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
import com.ai.cloud.skywalking.plugin.interceptor.matcher.AnyMethodMatcher;
public class JedisPluginDefine implements InterceptorDefine {
@@ -15,8 +15,8 @@ public class JedisPluginDefine implements InterceptorDefine {
}
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[] { new AnyMethodMatcher() };
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[] { new AnyMethodMatcher() };
}
@Override
diff --git a/skywalking-sdk-plugin/mysql-plugin/src/main/java/com/ai/cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java b/skywalking-sdk-plugin/mysql-plugin/src/main/java/com/ai/cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java
index 5137681bb..19cf72f06 100644
--- a/skywalking-sdk-plugin/mysql-plugin/src/main/java/com/ai/cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java
+++ b/skywalking-sdk-plugin/mysql-plugin/src/main/java/com/ai/cloud/skywalking/plugin/mysql/ConnectionPluginDefine.java
@@ -2,8 +2,8 @@ package com.ai.cloud.skywalking.plugin.mysql;
import com.ai.cloud.skywalking.plugin.interceptor.IAroundInterceptor;
import com.ai.cloud.skywalking.plugin.interceptor.InterceptorDefine;
-import com.ai.cloud.skywalking.plugin.interceptor.MethodNameMatcher;
-import com.ai.cloud.skywalking.plugin.interceptor.matcher.FullNameMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.MethodMatcher;
+import com.ai.cloud.skywalking.plugin.interceptor.matcher.SimpleMethodMatcher;
public class ConnectionPluginDefine implements InterceptorDefine {
@@ -13,12 +13,12 @@ public class ConnectionPluginDefine implements InterceptorDefine {
}
@Override
- public MethodNameMatcher[] getBeInterceptedMethodsMatchers() {
- return new MethodNameMatcher[] { new FullNameMatcher("createStatement", 2),
- new FullNameMatcher("prepareStatement", 3),
- new FullNameMatcher("prepareCall", 3),
- new FullNameMatcher("commit"), new FullNameMatcher("rollback"),
- new FullNameMatcher("close") };
+ public MethodMatcher[] getBeInterceptedMethodsMatchers() {
+ return new MethodMatcher[] { new SimpleMethodMatcher("createStatement", 2),
+ new SimpleMethodMatcher("prepareStatement", 3),
+ new SimpleMethodMatcher("prepareCall", 3),
+ new SimpleMethodMatcher("commit"), new SimpleMethodMatcher("rollback"),
+ new SimpleMethodMatcher("close") };
}
@Override