Given two pieces of advice, A and B:
A and B are defined in different aspects, then the advice
in the aspect with the lowest order value has the highest precedence.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 Note
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.
| Modifier and Type | Field and Description |
|---|---|
| private final Comparator | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AspectJPrecedenceComparator(Comparator<? super Advisor>
the advisorComparator)Comparator to use for advisorsCreate an |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(Advisor
the first object to be compared. o1, Advisor the second object to be compared. o2)Implements java. Compares its two arguments for order. |
| private int | |
| private boolean | |
| private int | |
| private String | |
| private boolean |
| advisorComparator | back to summary |
|---|---|
| private final Comparator<? super Advisor> advisorComparator | |
| HIGHER_PRECEDENCE | back to summary |
|---|---|
| private static final int HIGHER_PRECEDENCE | |
| LOWER_PRECEDENCE | back to summary |
|---|---|
| private static final int LOWER_PRECEDENCE | |
| SAME_PRECEDENCE | back to summary |
|---|---|
| private static final int SAME_PRECEDENCE | |
| AspectJPrecedenceComparator | back to summary |
|---|---|
| public AspectJPrecedenceComparator() Create a default | |
| AspectJPrecedenceComparator | back to summary |
|---|---|
| public AspectJPrecedenceComparator(Comparator<? super Advisor> advisorComparator) Create an
| |
| compare | back to summary |
|---|---|
| public int compare(Advisor o1, Advisor o2) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| comparePrecedenceWithinAspect | back to summary |
|---|---|
| private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) | |
| declaredInSameAspect | back to summary |
|---|---|
| private boolean declaredInSameAspect(Advisor advisor1, Advisor advisor2) | |
| getAspectDeclarationOrder | back to summary |
|---|---|
| private int getAspectDeclarationOrder(Advisor advisor) | |
| getAspectName | back to summary |
|---|---|
| private String getAspectName(Advisor advisor) | |
| hasAspectName | back to summary |
|---|---|
| private boolean hasAspectName(Advisor advisor) | |