类 AbstractAspectJAdvice

    • 字段详细资料

      • JOIN_POINT_KEY

        protected static final String JOIN_POINT_KEY
        Key used in ReflectiveMethodInvocation userAtributes map for the current joinpoint.
    • 构造器详细资料

      • AbstractAspectJAdvice

        public AbstractAspectJAdvice​(Method aspectJAdviceMethod,
                                     AspectJExpressionPointcut pointcut,
                                     AspectInstanceFactory aspectInstanceFactory)
        Create a new AbstractAspectJAdvice for the given advice method.
        参数:
        aspectJAdviceMethod - the AspectJ-style advice method
        pointcut - the AspectJ expression pointcut
        aspectInstanceFactory - the factory for aspect instances
    • 方法详细资料

      • currentJoinPoint

        public static org.aspectj.lang.JoinPoint currentJoinPoint()
        Lazily instantiate joinpoint for the current invocation. Requires MethodInvocation to be bound with ExposeInvocationInterceptor.

        Do not use if access is available to the current ReflectiveMethodInvocation (in an around advice).

        返回:
        current AspectJ joinpoint, or through an exception if we're not in a Spring AOP invocation.
      • buildSafePointcut

        public final Pointcut buildSafePointcut()
        Build a 'safe' pointcut that excludes the AspectJ advice method itself.
        返回:
        a composable pointcut that builds on the original AspectJ expression pointcut
        另请参阅:
        getPointcut()
      • getOrder

        public int getOrder()
        从接口复制的说明: Ordered
        Get the order value of this object.

        Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet load-on-startup values).

        Same order values will result in arbitrary sort positions for the affected objects.

        指定者:
        getOrder 在接口中 Ordered
        返回:
        the order value
        另请参阅:
        Ordered.HIGHEST_PRECEDENCE, Ordered.LOWEST_PRECEDENCE
      • setDeclarationOrder

        public void setDeclarationOrder​(int order)
        Set the declaration order of this advice within the aspect.
      • setArgumentNames

        public void setArgumentNames​(String argNames)
        Set by creator of this advice object if the argument names are known.

        This could be for example because they have been explicitly specified in XML, or in an advice annotation.

        参数:
        argNames - comma delimited list of arg names
      • setReturningNameNoCheck

        protected void setReturningNameNoCheck​(String name)
        We need to hold the returning name at this level for argument binding calculations, this method allows the afterReturning advice subclass to set the name.
      • setThrowingNameNoCheck

        protected void setThrowingNameNoCheck​(String name)
        We need to hold the throwing name at this level for argument binding calculations, this method allows the afterThrowing advice subclass to set the name.
      • calculateArgumentBindings

        public final void calculateArgumentBindings()
        Do as much work as we can as part of the set-up so that argument binding on subsequent advice invocations can be as fast as possible.

        If the first argument is of type JoinPoint or ProceedingJoinPoint then we pass a JoinPoint in that position (ProceedingJoinPoint for around advice).

        If the first argument is of type JoinPoint.StaticPart then we pass a JoinPoint.StaticPart in that position.

        Remaining arguments have to be bound by pointcut evaluation at a given join point. We will get back a map from argument name to value. We need to calculate which advice parameter needs to be bound to which argument name. There are multiple strategies for determining this binding, which are arranged in a ChainOfResponsibility.

      • argBinding

        protected Object[] argBinding​(org.aspectj.lang.JoinPoint jp,
                                      org.aspectj.weaver.tools.JoinPointMatch jpMatch,
                                      Object returnValue,
                                      Throwable ex)
        Take the arguments at the method execution join point and output a set of arguments to the advice method
        参数:
        jp - the current JoinPoint
        jpMatch - the join point match that matched this execution join point
        returnValue - the return value from the method execution (may be null)
        ex - the exception thrown by the method execution (may be null)
        返回:
        the empty array if there are no arguments
      • invokeAdviceMethod

        protected Object invokeAdviceMethod​(org.aspectj.weaver.tools.JoinPointMatch jpMatch,
                                            Object returnValue,
                                            Throwable ex)
                                     throws Throwable
        Invoke the advice method.
        参数:
        jpMatch - the JoinPointMatch that matched this execution join point
        returnValue - the return value from the method execution (may be null)
        ex - the exception thrown by the method execution (may be null)
        返回:
        the invocation result
        抛出:
        Throwable - in case of invocation failure
      • getJoinPoint

        protected org.aspectj.lang.JoinPoint getJoinPoint()
        Overridden in around advice to return proceeding join point.
      • getJoinPointMatch

        protected org.aspectj.weaver.tools.JoinPointMatch getJoinPointMatch()
        Get the current join point match at the join point we are being dispatched on.