类 AopAspect

  • 所有已实现的接口:
    cn.hutool.aop.aspects.Aspect

    public abstract class AopAspect
    extends Object
    implements cn.hutool.aop.aspects.Aspect
    • 构造器详细资料

      • AopAspect

        public AopAspect()
    • 方法详细资料

      • addMethod

        public void addMethod​(Method method)
        新增这个切面类需要拦截的方法
      • before

        public boolean before​(Object target,
                              Method method,
                              Object[] args)
        目标方法执行前的操作
        指定者:
        before 在接口中 cn.hutool.aop.aspects.Aspect
        参数:
        target - 目标对象
        method - 目标方法
        args - 参数
        返回:
        是否继续执行接下来的操作
      • doBefore

        public abstract boolean doBefore​(Object target,
                                         Method method,
                                         Object[] args)
      • after

        public boolean after​(Object target,
                             Method method,
                             Object[] args,
                             Object returnVal)
        目标方法执行后的操作 如果 target.method 抛出异常且
        指定者:
        after 在接口中 cn.hutool.aop.aspects.Aspect
        参数:
        target - 目标对象
        method - 目标方法
        args - 参数
        returnVal - 目标方法执行返回值
        返回:
        是否允许返回值(接下来的操作)
        另请参阅:
        返回true,则不会执行此操作 如果, 返回false,则无论target.method是否抛出异常,均会执行此操作
      • afterException

        public boolean afterException​(Object target,
                                      Method method,
                                      Object[] args,
                                      Throwable e)
        目标方法抛出异常时的操作
        指定者:
        afterException 在接口中 cn.hutool.aop.aspects.Aspect
        参数:
        target - 目标对象
        method - 目标方法
        args - 参数
        e - 异常
        返回:
        是否允许抛出异常