|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.elca.el4j.util.codingsupport.AopHelper
public class AopHelper
Similar to Spring's AOPUtil class, with some more features:
DefaultPerson p = new DefaultPerson();
p = addAdvice(p, 0, new AMixin(),
mySharedCInterceptor,
new BMixin());
// the next call now uses the 3 advices set up
p.setAge(11);
Remark: We delegate sometimes to the AOPUtil of Spring
(we duplicated the methods here for simplicity).
Constructor Summary | |
---|---|
AopHelper()
|
Method Summary | ||
---|---|---|
static
|
addAdvice(T object,
org.aopalliance.aop.Advice... advices)
Convenience method. |
|
static
|
addAdvice(T object,
int position,
org.aopalliance.aop.Advice... advices)
Add the advice(s) to the object. |
|
static String |
getClassNameOfCglibProxyClass(Class clazz)
Return the class name (String) of a CGLIB-generated class. |
|
static Class |
getClassOfCglibProxyClass(Class clazz)
Return the class (Class) of a CGLIB-generated class. |
|
static Class<?> |
getTargetClass(Object candidate)
Determine the target class of the given bean instance, which might be an AOP proxy. |
|
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 |
isJdkDynamicProxy(Object object)
Check whether the given object is a JDK dynamic proxy. |
|
static boolean |
isProxied(Object object)
Does the given object have Spring AOP support (i.e. |
|
static boolean |
isProxiedBy(Object object,
Class<? extends org.aopalliance.aop.Advice> cls)
Is the given object advised by an instance of the given advice class? |
|
static
|
removeAllAdvice(T object)
Remove all advice (and the proxy) that were added via Spring AOP. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AopHelper()
Method Detail |
---|
public static boolean isAopProxy(Object object)
object
- the object to checkisJdkDynamicProxy(java.lang.Object)
,
delegates to the same method of Spring's AopUtil
public static boolean isJdkDynamicProxy(Object object)
object
- the object to check
delegates to the same method of Spring's AopUtil
public static boolean isCglibProxy(Object object)
object
- the object to check
public static boolean isCglibProxyClass(Class<?> clazz)
clazz
- the class to check
public static String getClassNameOfCglibProxyClass(Class clazz)
clazz
- the class to work on
public static Class getClassOfCglibProxyClass(Class clazz)
clazz
-
public 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)
delegates to the same method of Spring's AopUtil
public static <T> T addAdvice(T object, int position, org.aopalliance.aop.Advice... advices)
AopHelper
.
object
- the object to wrapposition
- where in the advice chain this new advice should be
placed. 0 means at the beginning (=called first).advices
- the advise(s) (=the interceptors and mixins) to add
public static <T> T addAdvice(T object, org.aopalliance.aop.Advice... advices)
#addAdvice(Object, int, Advice)
The position is always set to 0 (=first position)
public static <T> T removeAllAdvice(T object)
object
-
public static boolean isProxied(Object object)
object
-
public static boolean isProxiedBy(Object object, Class<? extends org.aopalliance.aop.Advice> cls)
object
- the adviced objectcls
- the advice class
true
if object is adviced by given advice class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |