|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.support.AopUtils
public abstract class AopUtils
Utility methods for AOP support code. Mainly for internal use within Spring's AOP support.
See AopProxyUtils
for a
collection of framework-specific AOP utility methods which depend
on internals of Spring's AOP framework implementation.
AopProxyUtils
Constructor Summary | |
---|---|
AopUtils()
|
Method Summary | |
---|---|
static boolean |
canApply(Advisor advisor,
Class targetClass)
Can the given advisor apply at all on the given class? |
static boolean |
canApply(Advisor advisor,
Class targetClass,
boolean hasIntroductions)
Can the given advisor apply at all on the given class? |
static boolean |
canApply(Pointcut pc,
Class targetClass)
Can the given pointcut apply at all on the given class? |
static boolean |
canApply(Pointcut pc,
Class targetClass,
boolean hasIntroductions)
Can the given pointcut apply at all on the given class? |
static List |
findAdvisorsThatCanApply(List candidateAdvisors,
Class clazz)
Determine the sublist of the candidateAdvisors list
that is applicable to the given class. |
static Method |
getMostSpecificMethod(Method method,
Class targetClass)
Given a method, which may come from an interface, and a target class used in the current AOP invocation, find the corresponding target method if there is one. |
static Class |
getTargetClass(Object candidate)
Determine the target class of the given bean instance, which might be an AOP proxy. |
static Object |
invokeJoinpointUsingReflection(Object target,
Method method,
Object[] args)
Invoke the given target via reflection, as part of an AOP method invocation. |
static boolean |
isAopProxy(Object object)
Check whether the given object is a JDK dynamic proxy or a CGLIB proxy. |
static boolean |
isCglibProxy(Object object)
Check whether the given object is a CGLIB proxy. |
static boolean |
isCglibProxyClass(Class clazz)
Check whether the specified class is a CGLIB-generated class. |
static boolean |
isEqualsMethod(Method method)
Determine whether the given method is an "equals" method. |
static boolean |
isHashCodeMethod(Method method)
Determine whether the given method is a "hashCode" method. |
static boolean |
isJdkDynamicProxy(Object object)
Check whether the given object is a JDK dynamic proxy. |
static boolean |
isToStringMethod(Method method)
Determine whether the given method is a "toString" method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AopUtils()
Method Detail |
---|
public static boolean isAopProxy(Object object)
object
- the object to checkisJdkDynamicProxy(java.lang.Object)
,
isCglibProxy(java.lang.Object)
public static boolean isJdkDynamicProxy(Object object)
object
- the object to checkProxy.isProxyClass(java.lang.Class>)
public static boolean isCglibProxy(Object object)
object
- the object to checkpublic static boolean isCglibProxyClass(Class clazz)
clazz
- the class to checkpublic static Class getTargetClass(Object candidate)
Returns the target class for an AOP proxy and the plain class else.
candidate
- the instance to check (might be an AOP proxy)
TargetClassAware.getTargetClass()
public static boolean isEqualsMethod(Method method)
Object.equals(java.lang.Object)
public static boolean isHashCodeMethod(Method method)
Object.hashCode()
public static boolean isToStringMethod(Method method)
Object.toString()
public static Method getMostSpecificMethod(Method method, Class targetClass)
IFoo.bar()
and the target class
may be DefaultFoo
. In this case, the method may be
DefaultFoo.bar()
. This enables attributes on that method to be found.
method
- the method to be invoked, which may come from an interfacetargetClass
- the target class for the current invocation.
May be null
or may not even implement the method.
targetClass
doesn't implement it or is null
public static boolean canApply(Pointcut pc, Class targetClass)
This is an important test as it can be used to optimize out a pointcut for a class.
pc
- the static or dynamic pointcut to checktargetClass
- the class to test
public static boolean canApply(Pointcut pc, Class targetClass, boolean hasIntroductions)
This is an important test as it can be used to optimize out a pointcut for a class.
pc
- the static or dynamic pointcut to checktargetClass
- the class to testhasIntroductions
- whether or not the advisor chain
for this bean includes any introductions
public static boolean canApply(Advisor advisor, Class targetClass)
advisor
- the advisor to checktargetClass
- class we're testing
public static boolean canApply(Advisor advisor, Class targetClass, boolean hasIntroductions)
advisor
- the advisor to checktargetClass
- class we're testinghasIntroductions
- whether or not the advisor chain for this bean includes
any introductions
public static List findAdvisorsThatCanApply(List candidateAdvisors, Class clazz)
candidateAdvisors
list
that is applicable to the given class.
candidateAdvisors
- the Advisors to evaluateclazz
- the target class
public static Object invokeJoinpointUsingReflection(Object target, Method method, Object[] args) throws Throwable
target
- the target objectmethod
- the method to invokeargs
- the arguments for the method
Throwable
- if thrown by the target method
AopInvocationException
- in case of a reflection error
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |