public class Matchers extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Predicate<Class<?>> |
annotatedWithClass(Class<? extends Annotation> annotationType)
在类型中匹配注解
|
static Predicate<Method> |
annotatedWithMethod(Class<? extends Annotation> annotationType)
在方法中匹配注解
|
static Predicate<Class<?>> |
anyClass()
匹配任意类型
|
static Predicate<Class<?>> |
anyClassExcludes(Set<Class<?>> checkTypes)
任意一个在集合中不出现的
|
static Predicate<Class<?>> |
anyClassInclude(Set<Class<?>> checkTypes)
任意一个在集合中出现的
|
static Predicate<Method> |
anyMethod()
匹配任意方法
|
static Predicate<Method> |
anyMethod(Class<?> face)
属于接口的任意一个方法
|
static Predicate<Class<?>> |
expressionClass(String matcherExpression)
将表达式解析为
Matcher<Method>。 |
static Predicate<Method> |
expressionMethod(String matcherExpression)
使用表达式配置Aop。
|
static Predicate<Class<?>> |
subClassesOf(Class<?> superclass)
返回一个匹配器,匹配给定类型的子类(或实现了的接口)
|
static Predicate<Method> |
withMethod(Method method)
匹配任意方法
|
public static Predicate<Class<?>> annotatedWithClass(Class<? extends Annotation> annotationType)
public static Predicate<Method> annotatedWithMethod(Class<? extends Annotation> annotationType)
public static Predicate<Class<?>> subClassesOf(Class<?> superclass)
public static Predicate<Class<?>> expressionClass(String matcherExpression)
Matcher<Method>。
格式为:<包名>.<类名>,可以使用通配符。public static Predicate<Method> expressionMethod(String matcherExpression)
例:
格式:<返回值> <类名>.<方法名>(<参数签名列表>) * *.*() 匹配:任意无参方法 * *.*(*) 匹配:任意方法 * *.add*(*) 匹配:任意add开头的方法 * *.add*(*,*) 匹配:任意add开头并且具有两个参数的方法。 * net.test.hasor.*(*) 匹配:包“net.test.hasor”下的任意类,任意方法。 * net.test.hasor.add*(*) 匹配:包“net.test.hasor”下的任意类,任意add开头的方法。 java.lang.String *.*(*) 匹配:任意返回值为String类型的方法。
matcherExpression - 格式为“<返回值> <类名>.<方法名>(<参数签名列表>)”public static Predicate<Class<?>> anyClassInclude(Set<Class<?>> checkTypes)
public static Predicate<Class<?>> anyClassExcludes(Set<Class<?>> checkTypes)
[Web Site]