T
- 注解类,记得声明@Retention(RetentionPolicy.RUNTIME)哦public abstract class SimpleAopMaker<T extends Annotation> extends AbstractLifeCycle implements IocLoader, AopConfigration
1. 声明一个自定义注解
2. 声明一个AopLoader类,继承本类,实现makeIt方法
3. 在@IocBy中引用即可该AopLoader类即可
LifeCycle.Event, LifeCycle.Listener
限定符和类型 | 字段和说明 |
---|---|
protected Class<T> |
annoClass |
protected String |
iocName |
IOCNAME
构造器和说明 |
---|
SimpleAopMaker() |
限定符和类型 | 方法和说明 |
---|---|
Class<T> |
_anno() |
String |
_name() |
boolean |
checkClass(Class<?> klass) |
boolean |
checkMethod(Method method) |
List<InterceptorPair> |
getInterceptorPairList(Ioc ioc,
Class<?> klass)
获取需要method与拦截器的对应关系,建议不要返回null
|
String[] |
getName() |
boolean |
has(String name) |
IocObject |
load(IocLoading loading,
String name)
每次这个函数被调用,则要构造一个新的 IocObject
|
abstract List<? extends MethodInterceptor> |
makeIt(T t,
Method method,
Ioc ioc) |
depose, fetch, init, trigger
protected Class<T extends Annotation> annoClass
protected String iocName
public String _name()
public abstract List<? extends MethodInterceptor> makeIt(T t, Method method, Ioc ioc)
public boolean checkMethod(Method method)
public boolean checkClass(Class<?> klass)
public List<InterceptorPair> getInterceptorPairList(Ioc ioc, Class<?> klass)
AopConfigration
getInterceptorPairList
在接口中 AopConfigration
ioc
- 如果拦截器来自ioc容器,则需要提供这个参数klass
- 需要拦截的类public IocObject load(IocLoading loading, String name) throws ObjectLoadException
IocLoader
load
在接口中 IocLoader
ObjectLoadException
Copyright © 2017. All rights reserved.