A
- the generic typepublic abstract class Aspect<A>
extends Object
implements javassist.util.proxy.MethodHandler
A
as a parameter or instance of the Class
the Aspect instantiate a new class which extends A
but has all methods of the original class intercepted. So it is possible to write a pre or
post conditions or completely replace method's code.
The particular class which extends Aspect should override intercept. The default implementation just calls a method from the A
class.
Constructor and Description |
---|
Aspect() |
Modifier and Type | Method and Description |
---|---|
A |
getAspect()
Returns the new class which extends
A but intercept all its methods. |
void |
init(A original)
Instantiate the new class which extends
A but intercept all its methods. |
void |
init(Class<A> clazz)
Instantiate the new class which extends
A but intercept all its methods. |
void |
init(String className)
Instantiate the new class which extends
className but intercept all its methods. |
Object |
invoke(Object obj,
Method m,
Method method,
Object[] args) |
public A getAspect()
A
but intercept all its methods.public void init(A original)
A
but intercept all its methods.original
- the original objectpublic void init(Class<A> clazz)
A
but intercept all its methods.clazz
- the original classpublic void init(String className)
className
but intercept all its methods.className
- the class namepublic Object invoke(Object obj, Method m, Method method, Object[] args) throws Throwable
invoke
in interface javassist.util.proxy.MethodHandler
Throwable
Copyright © 2010-2020 Toolsverse. All Rights Reserved.