org.aspectj.lang.JoinPoint解析
来源:互联网 发布:无网络怎么安装手写板 编辑:程序博客网 时间:2024/06/08 11:15
1)JoinPoint
Object[] getArgs():获取连接点方法运行时的传入参列表;
Signature getSignature() :获取连接点的方法对象;
Object getTarget() :获取连接点所在的目标对象;
Object getThis() :获取代理对象本身;
2)ProceedingJoinPoint
ProceedingJoinPoint继承JoinPoint子接口,它只是新增了两个用于执行连接点方法的方法:
proceed() throws java.lang.Throwable:通过反射执行目标对象的连接点处的方法;
proceed(java.lang.Object[] args) throws java.lang.Throwable:通过反射执行目标对象连接点处的方法,使用新的入参替换原来的入参。
使用介绍:
private Log logger = LogFactory.getLog(LogAspect.class);
public void doSystemLog(JoinPoint point) throws Throwable {
Object[] param = point.getArgs();
for(int i=0;i<param.length;i++){
System.out.println("参数"+i+"=: "+param[i]);
}
Method method = null;
String methodName = point.getSignature().getName();
System.out.println("签名方法:================"+methodName);
if (!(methodName.startsWith("set") || methodName.startsWith("get")||methodName.startsWith("query"))){
Class targetClass = point.getTarget().getClass();
System.out.println("类名:================"+targetClass.getName());
try {
method = targetClass.getMethod(methodName, param[0].getClass());
} catch (Exception e) {
// TODO: handle exception
}
System.out.println("类方法:================"+method);
if (method != null) {
boolean hasAnnotation = method.isAnnotationPresent(Log.class);
if (hasAnnotation) {
Log annotation = method.getAnnotation(Log.class);
String methodDescp = annotation.operationType()+annotation.operationName();
if (logger.isDebugEnabled()) {
logger.debug("Action method:" + method.getName() + " Description:" + methodDescp);
}
}
}
}
}
- org.aspectj.lang.JoinPoint解析
- NoClassDefFoundError: org/aspectj/lang/JoinPoint
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API
- spring aop 中 org.aspectj.lang.JoinPoint-中文简要API
- org.aspectj.lang.JoinPoint-中文简要API 与pointcut expression表达式
- ubuntu集群相关杂项
- Android 签名apk时候报conversion to dalvik format failed with error 1解决办法
- 绘制Android的机器人
- Android之值得开发者(安卓)必备的十八大开发资源
- 延长tableviewcell分割线到最左侧
- org.aspectj.lang.JoinPoint解析
- HTTP协议详解
- UIViewController生命周期及应用界面切换
- js高级
- 为什么servlet从请求得到的cookies是一个数组而不是一个cookie
- Android打造(ListView、GridView等)通用的下拉刷新、上拉自动加载的组件
- .NET创建Windows服务详细步骤(C#)
- 编译Opencv3.0.0+contribe modules
- 最大子序列和算法