spring-framework / org.springframework.aop.support / AopUtils / canApply

canApply

open static fun canApply(pc: Pointcut, targetClass: Class<*>): Boolean

Can the given pointcut apply at all on the given class?

This is an important test as it can be used to optimize out a pointcut for a class.

Parameters

pc - the static or dynamic pointcut to check

targetClass - the class to test

Return
whether the pointcut can apply on any method

open static fun canApply(pc: Pointcut, targetClass: Class<*>, hasIntroductions: Boolean): Boolean

Can the given pointcut apply at all on the given class?

This is an important test as it can be used to optimize out a pointcut for a class.

Parameters

pc - the static or dynamic pointcut to check

targetClass - the class to test

hasIntroductions - whether or not the advisor chain for this bean includes any introductions

Return
whether the pointcut can apply on any method

open static fun canApply(advisor: Advisor, targetClass: Class<*>): Boolean

Can the given advisor apply at all on the given class? This is an important test as it can be used to optimize out a advisor for a class.

Parameters

advisor - the advisor to check

targetClass - class we're testing

Return
whether the pointcut can apply on any method

open static fun canApply(advisor: Advisor, targetClass: Class<*>, hasIntroductions: Boolean): Boolean

Can the given advisor apply at all on the given class?

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).

Parameters

advisor - the advisor to check

targetClass - class we're testing

hasIntroductions - whether or not the advisor chain for this bean includes any introductions

Return
whether the pointcut can apply on any method