类 AspectJPrecedenceComparator

java.lang.Object
infra.aop.aspectj.autoproxy.AspectJPrecedenceComparator
所有已实现的接口:
Comparator<Advisor>

class AspectJPrecedenceComparator extends Object implements Comparator<Advisor>
Orders AspectJ advice/advisors by precedence (not invocation order).

Given two pieces of advice, A and B:

  • If A and B are defined in different aspects, then the advice in the aspect with the lowest order value has the highest precedence.
  • If A and B are defined in the same aspect, if one of A or B is a form of after advice, then the advice declared last in the aspect has the highest precedence. If neither A nor B is a form of after advice, then the advice declared first in the aspect has the highest precedence.

Important: This comparator is used with AspectJ's PartialOrder sorting utility. Thus, unlike a normal Comparator, a return value of 0 from this comparator means we don't care about the ordering, not that the two elements must be sorted identically.

从以下版本开始:
4.0
作者:
Adrian Colyer, Juergen Hoeller
  • 字段详细资料

    • HIGHER_PRECEDENCE

      private static final int HIGHER_PRECEDENCE
      另请参阅:
    • SAME_PRECEDENCE

      private static final int SAME_PRECEDENCE
      另请参阅:
    • LOWER_PRECEDENCE

      private static final int LOWER_PRECEDENCE
      另请参阅:
    • advisorComparator

      private final Comparator<? super Advisor> advisorComparator
  • 构造器详细资料

    • AspectJPrecedenceComparator

      public AspectJPrecedenceComparator()
      Create a default AspectJPrecedenceComparator.
    • AspectJPrecedenceComparator

      public AspectJPrecedenceComparator(Comparator<? super Advisor> advisorComparator)
      Create an AspectJPrecedenceComparator, using the given Comparator for comparing Advisor instances.
      参数:
      advisorComparator - the Comparator to use for advisors
  • 方法详细资料

    • compare

      public int compare(Advisor o1, Advisor o2)
      指定者:
      compare 在接口中 Comparator<Advisor>
    • comparePrecedenceWithinAspect

      private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2)
    • declaredInSameAspect

      private boolean declaredInSameAspect(Advisor advisor1, Advisor advisor2)
    • hasAspectName

      private boolean hasAspectName(Advisor advisor)
    • getAspectName

      private String getAspectName(Advisor advisor)
    • getAspectDeclarationOrder

      private int getAspectDeclarationOrder(Advisor advisor)