📄 interceptorclass.java
字号:
package xyz.frame.interceptor;import java.util.List;import org.apache.log4j.Logger;import xyz.frame.Interceptor;import xyz.frame.annotations.In;import xyz.frame.annotations.Out;import xyz.frame.component.ComponentInstantiationException;import xyz.frame.component.FieldAnnotation;import xyz.frame.util.ReflectionUtil;/** * Interceptor class to deal with interceptors instances * * @author Guilherme Silveira */public class InterceptorClass { private static final Logger logger = Logger .getLogger(InterceptorClass.class); private Class<? extends Interceptor> clazz; /** Out annotations */ private List<FieldAnnotation<Out>> outAnnotations; /** In annotations */ private List<FieldAnnotation<In>> inAnnotations; /** * New interceptor class * * @param c * class */ public InterceptorClass(Class<? extends Interceptor> c) { logger.info("Reading interceptor class " + c.getName()); this.clazz = c; this.outAnnotations = ReflectionUtil.readAnnotations(this.clazz, Out.class); this.inAnnotations = ReflectionUtil.readAnnotations(this.clazz, In.class); InterceptorClass.logger.debug("Interceptor " + c.getName() + "read"); } public Interceptor newInstance() throws ComponentInstantiationException { return ReflectionUtil.instantiate(this.clazz); } /** * @return Returns the outAnnotations. */ public List<FieldAnnotation<Out>> getOutAnnotations() { return this.outAnnotations; } /** * @return Returns the inAnnotations. */ public List<FieldAnnotation<In>> getInAnnotations() { return this.inAnnotations; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -