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
Modifier and Type | Field and Description |
---|---|
protected Class<T> |
annoClass |
protected String |
iocName |
IOCNAME
Constructor and Description |
---|
SimpleAopMaker() |
Modifier and Type | Method and Description |
---|---|
Class<T> |
_anno() |
String |
_name() |
boolean |
checkClass(Class<?> klass) |
boolean |
checkMethod(Method method) |
List<InterceptorPair> |
getInterceptorPairList(Ioc ioc,
Class<?> klass)
获取需要method与拦截器的对应关系,建议不要返回null
|
protected Method[] |
getMethods(Ioc ioc,
Class<?> klass) |
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
in interface AopConfigration
ioc
- 如果拦截器来自ioc容器,则需要提供这个参数klass
- 需要拦截的类public String[] getName()
public IocObject load(IocLoading loading, String name) throws ObjectLoadException
IocLoader
load
in interface IocLoader
ObjectLoadException
Copyright © 2017. All rights reserved.