zoukankan      html  css  js  c++  java
  • ProceedingJoinPoint 某些方法记录一下

    转载与百度知道,记录一下。遇到在去看API 官方文档

    //
    拦截的实体类 Object target = point.getTarget(); //拦截的方法名称 String methodName = point.getSignature().getName(); //拦截的方法参数 Object[] args = point.getArgs(); //拦截的放参数类型 Class[] parameterTypes = ((MethodSignature)point.getSignature()).getMethod().getParameterTypes(); Method m = null; try { //通过反射获得拦截的method m = target.getClass().getMethod(methodName, parameterTypes); //如果是桥则要获得实际拦截的method if(m.isBridge()){ for(int i = 0; i < args.length; i++){ //获得泛型类型 Class genClazz = GenericsUtils.getSuperClassGenricType(target.getClass()); //根据实际参数类型替换parameterType中的类型 if(args[i].getClass().isAssignableFrom(genClazz)){ parameterTypes[i] = genClazz; } } //获得parameterType参数类型的方法 m = target.getClass().getMethod(methodName, parameterTypes); } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } }
    一万年太久,只争朝夕!
  • 相关阅读:
    Hibernate 工作原理及为什么要用
    一款很好用的JQuery dtree树状图插件(一)
    android PopupWindow
    android 截屏工具类
    ubuntu 中文输入法
    Google GCM推送
    windows 安装配置 ant
    (转)Angular中的拦截器Interceptor
    flex 布局 自己做的demo
    flex布局 (转)
  • 原文地址:https://www.cnblogs.com/chaoba/p/10503815.html
Copyright © 2011-2022 走看看