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();
  • 相关阅读:
    deepin系统换软件下载源&商店卡死刷新空白问题解决
    php数组和json数组之间的互相转化
    php 获取数组个数的方法
    php 三种文件下载的实现
    win10激活
    deepin/linux安装exe
    deepin连接windows
    deepin升级微信
    deepin安装.net core
    在Deepin 15.9下安装Wine 4.0
  • 原文地址:https://www.cnblogs.com/draymond/p/12670123.html
Copyright © 2011-2022 走看看