|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.codehaus.nanning.AspectInstance
The central concept of the Nanning Core, contains mixins. Use like this:
AspectInstance instance = new AspectInstance();
Mixin mixin = new Mixin();
mixin.setInterfaceClass(Intf.class);
mixin.addInterceptor(new MockInterceptor());
mixin.addInterceptor(new NullInterceptor());
mixin.setTarget(new Impl());
instance.addMixin(mixin);
| Nested Class Summary | |
class |
AspectInstance.ConstructionInvocationImpl
|
| Constructor Summary | |
AspectInstance()
|
|
AspectInstance(AspectFactory aspectFactory,
java.lang.Class classIdentifier)
|
|
AspectInstance(java.lang.Class classIdentifier)
|
|
| Method Summary | |
void |
addConstructionInterceptor(ConstructionInterceptor constructionInterceptor)
Adds a ConstructionInterceptor, the interceptor will be invoked when creating the proxy in getProxy(). |
void |
addInterceptor(MethodInterceptor interceptor)
|
void |
addMixin(Mixin mixin)
Adds a mixin. |
java.util.Set |
getAllInterceptors()
Returns all the interceptors referenced by this aspect instance. |
AspectFactory |
getAspectFactory()
Returns the AspectFactory used to create and configure this AspectInstance (if set by the AspectFactory). |
java.lang.Class |
getClassIdentifier()
|
java.util.List |
getInterceptorsForMethod(java.lang.reflect.Method method)
Returns the interceptors of the specified method, searches in the mixin for the interface that the method has been declared on. |
Mixin |
getMixinForInterface(java.lang.Class interfaceClass)
Returns the mixin with the specified interface. |
java.util.List |
getMixins()
Returns all mixins defined on this AspectInstance. |
java.lang.Object |
getProxy()
|
java.lang.Object[] |
getTargets()
|
boolean |
hasMixinForInterface(java.lang.Class interfaceClass)
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
void |
setMixins(java.util.List mixinsList)
|
void |
setTarget(java.lang.Class interfaceClass,
java.lang.Object target)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AspectInstance()
public AspectInstance(AspectFactory aspectFactory,
java.lang.Class classIdentifier)
public AspectInstance(java.lang.Class classIdentifier)
| Method Detail |
public java.lang.Object invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
throws java.lang.Throwable
invoke in interface java.lang.reflect.InvocationHandlerjava.lang.Throwablepublic Mixin getMixinForInterface(java.lang.Class interfaceClass)
interfaceClass -
public boolean hasMixinForInterface(java.lang.Class interfaceClass)
public void setTarget(java.lang.Class interfaceClass,
java.lang.Object target)
public java.lang.Object[] getTargets()
public java.lang.Class getClassIdentifier()
public void addMixin(Mixin mixin)
mixin - public void setMixins(java.util.List mixinsList)
public java.util.Set getAllInterceptors()
public java.util.List getInterceptorsForMethod(java.lang.reflect.Method method)
method -
public final AspectFactory getAspectFactory()
public java.lang.Object getProxy()
public java.lang.String toString()
public java.util.List getMixins()
public void addConstructionInterceptor(ConstructionInterceptor constructionInterceptor)
getProxy().
public void addInterceptor(MethodInterceptor interceptor)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||