zoukankan      html  css  js  c++  java
  • Aop JoinPoint方法详解

    重要方法
            /*获取参数的值数组*/
            Object[] args = point.getArgs();                                    //  [1] 参数的值
            /*获取目标对象(被加强的对象)*/
            Object target = point.getTarget();
            /*获取signature 该注解作用在方法上,强转为 MethodSignature*/
            MethodSignature signature = (MethodSignature) point.getSignature();
            /*方法名*/
            String signatureName = signature.getName();                         //  findById
            /*参数名称数组(与args参数值意义对应)*/
            String[] parameterNames = signature.getParameterNames();            //  [i] 参数名称
            /*获取执行的方法对应Method对象*/
            Method method = signature.getMethod();                              //  public void com.draymond.aop2.service.UserService.findById(int)
            /*获取返回值类型*/
            Class returnType = signature.getReturnType();                       //  void
            /*获取方法上的注解*/
            WebAnnotation webAnnotation = method.getDeclaredAnnotation(WebAnnotation.class);

    常用的其他对象 request / response

         // 获取request/response(ThreadLocal模式)
            RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
            ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
            HttpServletRequest request = servletRequestAttributes.getRequest();
            HttpServletResponse response = servletRequestAttributes.getResponse();
  • 相关阅读:
    原生JS---2
    PHP中include和require绝对路径、相对路径问题
    魔方(小玩具)
    html5技术介绍
    苹果电脑 快捷键
    写代码的心得,怎么减少编程中的 bug?
    http状态代码含义表
    开源项目
    蓝牙 CoreBluetooth
    减小iOS应用程序的大小
  • 原文地址:https://www.cnblogs.com/draymond/p/12670123.html
Copyright © 2011-2022 走看看