org.springframework.aop.aspectj.AspectJAopUtils Java Examples

The following examples show how to use org.springframework.aop.aspectj.AspectJAopUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AspectJPrecedenceComparator.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) {
	boolean oneOrOtherIsAfterAdvice =
			(AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
	int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2);

	if (oneOrOtherIsAfterAdvice) {
		// the advice declared last has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has lower precedence
			return LOWER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return HIGHER_PRECEDENCE;
		}
	}
	else {
		// the advice declared first has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has higher precedence
			return HIGHER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return LOWER_PRECEDENCE;
		}
	}
}
 
Example #2
Source File: AspectJPrecedenceComparator.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private int getAspectDeclarationOrder(Advisor anAdvisor) {
	AspectJPrecedenceInformation precedenceInfo =
		AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
	if (precedenceInfo != null) {
		return precedenceInfo.getDeclarationOrder();
	}
	else {
		return 0;
	}
}
 
Example #3
Source File: AspectJPrecedenceComparator.java    From java-technology-stack with MIT License 5 votes vote down vote up
private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) {
	boolean oneOrOtherIsAfterAdvice =
			(AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
	int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2);

	if (oneOrOtherIsAfterAdvice) {
		// the advice declared last has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has lower precedence
			return LOWER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return HIGHER_PRECEDENCE;
		}
	}
	else {
		// the advice declared first has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has higher precedence
			return HIGHER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return LOWER_PRECEDENCE;
		}
	}
}
 
Example #4
Source File: AspectJPrecedenceComparator.java    From java-technology-stack with MIT License 5 votes vote down vote up
private int getAspectDeclarationOrder(Advisor anAdvisor) {
	AspectJPrecedenceInformation precedenceInfo =
		AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
	if (precedenceInfo != null) {
		return precedenceInfo.getDeclarationOrder();
	}
	else {
		return 0;
	}
}
 
Example #5
Source File: AspectJPrecedenceComparator.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) {
	boolean oneOrOtherIsAfterAdvice =
			(AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
	int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2);

	if (oneOrOtherIsAfterAdvice) {
		// the advice declared last has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has lower precedence
			return LOWER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return HIGHER_PRECEDENCE;
		}
	}
	else {
		// the advice declared first has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has higher precedence
			return HIGHER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return LOWER_PRECEDENCE;
		}
	}
}
 
Example #6
Source File: AspectJPrecedenceComparator.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private int getAspectDeclarationOrder(Advisor anAdvisor) {
	AspectJPrecedenceInformation precedenceInfo =
		AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
	if (precedenceInfo != null) {
		return precedenceInfo.getDeclarationOrder();
	}
	else {
		return 0;
	}
}
 
Example #7
Source File: AspectJPrecedenceComparator.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private int comparePrecedenceWithinAspect(Advisor advisor1, Advisor advisor2) {
	boolean oneOrOtherIsAfterAdvice =
			(AspectJAopUtils.isAfterAdvice(advisor1) || AspectJAopUtils.isAfterAdvice(advisor2));
	int adviceDeclarationOrderDelta = getAspectDeclarationOrder(advisor1) - getAspectDeclarationOrder(advisor2);

	if (oneOrOtherIsAfterAdvice) {
		// the advice declared last has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has lower precedence
			return LOWER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return HIGHER_PRECEDENCE;
		}
	}
	else {
		// the advice declared first has higher precedence
		if (adviceDeclarationOrderDelta < 0) {
			// advice1 was declared before advice2
			// so advice1 has higher precedence
			return HIGHER_PRECEDENCE;
		}
		else if (adviceDeclarationOrderDelta == 0) {
			return SAME_PRECEDENCE;
		}
		else {
			return LOWER_PRECEDENCE;
		}
	}
}
 
Example #8
Source File: AspectJPrecedenceComparator.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private int getAspectDeclarationOrder(Advisor anAdvisor) {
	AspectJPrecedenceInformation precedenceInfo =
		AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
	if (precedenceInfo != null) {
		return precedenceInfo.getDeclarationOrder();
	}
	else {
		return 0;
	}
}
 
Example #9
Source File: AspectJPrecedenceComparator.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private String getAspectName(Advisor anAdvisor) {
	AspectJPrecedenceInformation pi = AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
	Assert.state(pi != null, "Unresolvable precedence information");
	return pi.getAspectName();
}
 
Example #10
Source File: AspectJPrecedenceComparator.java    From java-technology-stack with MIT License 4 votes vote down vote up
private String getAspectName(Advisor anAdvisor) {
	AspectJPrecedenceInformation pi = AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor);
	Assert.state(pi != null, "Unresolvable precedence information");
	return pi.getAspectName();
}
 
Example #11
Source File: AspectJPrecedenceComparator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private String getAspectName(Advisor anAdvisor) {
	return AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor).getAspectName();
}
 
Example #12
Source File: AspectJPrecedenceComparator.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private String getAspectName(Advisor anAdvisor) {
	return AspectJAopUtils.getAspectJPrecedenceInformationFor(anAdvisor).getAspectName();
}