org.springframework.aop.PointcutAdvisor Java Examples

The following examples show how to use org.springframework.aop.PointcutAdvisor. 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: EagleTraceCglibProxy.java    From eagle with Apache License 2.0 5 votes vote down vote up
private boolean equalsPointcuts(Advisor a, Advisor b) {
    // If only one of the advisor (but not both) is PointcutAdvisor, then it is a mismatch.
    // Takes care of the situations where an IntroductionAdvisor is used (see SPR-3959).
    return (!(a instanceof PointcutAdvisor) ||
            (b instanceof PointcutAdvisor &&
                    ObjectUtils.nullSafeEquals(((PointcutAdvisor) a).getPointcut(), ((PointcutAdvisor) b).getPointcut())));
}
 
Example #2
Source File: CglibAopProxy.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private boolean equalsPointcuts(Advisor a, Advisor b) {
	// If only one of the advisor (but not both) is PointcutAdvisor, then it is a mismatch.
	// Takes care of the situations where an IntroductionAdvisor is used (see SPR-3959).
	return (!(a instanceof PointcutAdvisor) ||
			(b instanceof PointcutAdvisor &&
					ObjectUtils.nullSafeEquals(((PointcutAdvisor) a).getPointcut(), ((PointcutAdvisor) b).getPointcut())));
}
 
Example #3
Source File: AbstractPointcutAdvisor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!(other instanceof PointcutAdvisor)) {
		return false;
	}
	PointcutAdvisor otherAdvisor = (PointcutAdvisor) other;
	return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) &&
			ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
}
 
Example #4
Source File: AopUtils.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Can the given advisor apply at all on the given class?
 * <p>This is an important test as it can be used to optimize out a advisor for a class.
 * This version also takes into account introductions (for IntroductionAwareMethodMatchers).
 * @param advisor the advisor to check
 * @param targetClass class we're testing
 * @param hasIntroductions whether or not the advisor chain for this bean includes
 * any introductions
 * @return whether the pointcut can apply on any method
 */
public static boolean canApply(Advisor advisor, Class<?> targetClass, boolean hasIntroductions) {
	if (advisor instanceof IntroductionAdvisor) {
		return ((IntroductionAdvisor) advisor).getClassFilter().matches(targetClass);
	}
	else if (advisor instanceof PointcutAdvisor) {
		PointcutAdvisor pca = (PointcutAdvisor) advisor;
		return canApply(pca.getPointcut(), targetClass, hasIntroductions);
	}
	else {
		// It doesn't have a pointcut so we assume it applies.
		return true;
	}
}
 
Example #5
Source File: AspectJProxyUtils.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Determine whether the given Advisor contains an AspectJ advice.
 * @param advisor the Advisor to check
 */
private static boolean isAspectJAdvice(Advisor advisor) {
	return (advisor instanceof InstantiationModelAwarePointcutAdvisor ||
			advisor.getAdvice() instanceof AbstractAspectJAdvice ||
			(advisor instanceof PointcutAdvisor &&
					 ((PointcutAdvisor) advisor).getPointcut() instanceof AspectJExpressionPointcut));
}
 
Example #6
Source File: CglibAopProxy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private boolean equalsPointcuts(Advisor a, Advisor b) {
	// If only one of the advisor (but not both) is PointcutAdvisor, then it is a mismatch.
	// Takes care of the situations where an IntroductionAdvisor is used (see SPR-3959).
	return (!(a instanceof PointcutAdvisor) ||
			(b instanceof PointcutAdvisor &&
					ObjectUtils.nullSafeEquals(((PointcutAdvisor) a).getPointcut(), ((PointcutAdvisor) b).getPointcut())));
}
 
Example #7
Source File: AbstractPointcutAdvisor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!(other instanceof PointcutAdvisor)) {
		return false;
	}
	PointcutAdvisor otherAdvisor = (PointcutAdvisor) other;
	return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) &&
			ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
}
 
Example #8
Source File: AopUtils.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Can the given advisor apply at all on the given class?
 * <p>This is an important test as it can be used to optimize out a advisor for a class.
 * This version also takes into account introductions (for IntroductionAwareMethodMatchers).
 * @param advisor the advisor to check
 * @param targetClass class we're testing
 * @param hasIntroductions whether or not the advisor chain for this bean includes
 * any introductions
 * @return whether the pointcut can apply on any method
 */
public static boolean canApply(Advisor advisor, Class<?> targetClass, boolean hasIntroductions) {
	if (advisor instanceof IntroductionAdvisor) {
		return ((IntroductionAdvisor) advisor).getClassFilter().matches(targetClass);
	}
	else if (advisor instanceof PointcutAdvisor) {
		PointcutAdvisor pca = (PointcutAdvisor) advisor;
		return canApply(pca.getPointcut(), targetClass, hasIntroductions);
	}
	else {
		// It doesn't have a pointcut so we assume it applies.
		return true;
	}
}
 
Example #9
Source File: AspectJProxyUtils.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine whether the given Advisor contains an AspectJ advice.
 * @param advisor the Advisor to check
 */
private static boolean isAspectJAdvice(Advisor advisor) {
	return (advisor instanceof InstantiationModelAwarePointcutAdvisor ||
			advisor.getAdvice() instanceof AbstractAspectJAdvice ||
			(advisor instanceof PointcutAdvisor &&
					 ((PointcutAdvisor) advisor).getPointcut() instanceof AspectJExpressionPointcut));
}
 
Example #10
Source File: AspectJProxyUtils.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Determine whether the given Advisor contains an AspectJ advice.
 * @param advisor the Advisor to check
 */
private static boolean isAspectJAdvice(Advisor advisor) {
	return (advisor instanceof InstantiationModelAwarePointcutAdvisor ||
			advisor.getAdvice() instanceof AbstractAspectJAdvice ||
			(advisor instanceof PointcutAdvisor &&
					((PointcutAdvisor) advisor).getPointcut() instanceof AspectJExpressionPointcut));
}
 
Example #11
Source File: CglibAopProxy.java    From java-technology-stack with MIT License 5 votes vote down vote up
private boolean equalsPointcuts(Advisor a, Advisor b) {
	// If only one of the advisor (but not both) is PointcutAdvisor, then it is a mismatch.
	// Takes care of the situations where an IntroductionAdvisor is used (see SPR-3959).
	return (!(a instanceof PointcutAdvisor) ||
			(b instanceof PointcutAdvisor &&
					ObjectUtils.nullSafeEquals(((PointcutAdvisor) a).getPointcut(), ((PointcutAdvisor) b).getPointcut())));
}
 
Example #12
Source File: AbstractPointcutAdvisor.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!(other instanceof PointcutAdvisor)) {
		return false;
	}
	PointcutAdvisor otherAdvisor = (PointcutAdvisor) other;
	return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) &&
			ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
}
 
Example #13
Source File: AopUtils.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Can the given advisor apply at all on the given class?
 * <p>This is an important test as it can be used to optimize out a advisor for a class.
 * This version also takes into account introductions (for IntroductionAwareMethodMatchers).
 * @param advisor the advisor to check
 * @param targetClass class we're testing
 * @param hasIntroductions whether or not the advisor chain for this bean includes
 * any introductions
 * @return whether the pointcut can apply on any method
 */
public static boolean canApply(Advisor advisor, Class<?> targetClass, boolean hasIntroductions) {
	if (advisor instanceof IntroductionAdvisor) {
		return ((IntroductionAdvisor) advisor).getClassFilter().matches(targetClass);
	}
	else if (advisor instanceof PointcutAdvisor) {
		PointcutAdvisor pca = (PointcutAdvisor) advisor;
		return canApply(pca.getPointcut(), targetClass, hasIntroductions);
	}
	else {
		// It doesn't have a pointcut so we assume it applies.
		return true;
	}
}
 
Example #14
Source File: AspectJProxyUtils.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Determine whether the given Advisor contains an AspectJ advice.
 * @param advisor the Advisor to check
 */
private static boolean isAspectJAdvice(Advisor advisor) {
	return (advisor instanceof InstantiationModelAwarePointcutAdvisor ||
			advisor.getAdvice() instanceof AbstractAspectJAdvice ||
			(advisor instanceof PointcutAdvisor &&
					((PointcutAdvisor) advisor).getPointcut() instanceof AspectJExpressionPointcut));
}
 
Example #15
Source File: CglibAopProxy.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private boolean equalsPointcuts(Advisor a, Advisor b) {
	// If only one of the advisor (but not both) is PointcutAdvisor, then it is a mismatch.
	// Takes care of the situations where an IntroductionAdvisor is used (see SPR-3959).
	return (!(a instanceof PointcutAdvisor) ||
			(b instanceof PointcutAdvisor &&
					ObjectUtils.nullSafeEquals(((PointcutAdvisor) a).getPointcut(), ((PointcutAdvisor) b).getPointcut())));
}
 
Example #16
Source File: AbstractPointcutAdvisor.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!(other instanceof PointcutAdvisor)) {
		return false;
	}
	PointcutAdvisor otherAdvisor = (PointcutAdvisor) other;
	return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) &&
			ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
}
 
Example #17
Source File: AopUtils.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Can the given advisor apply at all on the given class?
 * <p>This is an important test as it can be used to optimize out a advisor for a class.
 * This version also takes into account introductions (for IntroductionAwareMethodMatchers).
 * @param advisor the advisor to check
 * @param targetClass class we're testing
 * @param hasIntroductions whether or not the advisor chain for this bean includes
 * any introductions
 * @return whether the pointcut can apply on any method
 */
public static boolean canApply(Advisor advisor, Class<?> targetClass, boolean hasIntroductions) {
	if (advisor instanceof IntroductionAdvisor) {
		return ((IntroductionAdvisor) advisor).getClassFilter().matches(targetClass);
	}
	else if (advisor instanceof PointcutAdvisor) {
		PointcutAdvisor pca = (PointcutAdvisor) advisor;
		return canApply(pca.getPointcut(), targetClass, hasIntroductions);
	}
	else {
		// It doesn't have a pointcut so we assume it applies.
		return true;
	}
}
 
Example #18
Source File: AbstractPointcutAdvisor.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public int hashCode() {
	return PointcutAdvisor.class.hashCode();
}
 
Example #19
Source File: AbstractPointcutAdvisor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
	return PointcutAdvisor.class.hashCode();
}
 
Example #20
Source File: AbstractPointcutAdvisor.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public int hashCode() {
	return PointcutAdvisor.class.hashCode();
}
 
Example #21
Source File: AbstractPointcutAdvisor.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
	return PointcutAdvisor.class.hashCode();
}