|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.cajo.utils.extra.InterceptorItem
public class InterceptorItem
This class is used to transparently intercept method invocations on any given object reference. It is typically used to dynamically substitute functionality, without having to change the implementation of the intercepted object. If the interceptor object does not wish to process a particular invocation, it will be automatically passed to the intercepted object for processing.
Field Summary | |
---|---|
static java.lang.Object |
CONTINUE
This object is used a signal from an interceptor object. |
java.lang.Object |
interceptor
The interceptor object. |
java.lang.Object |
item
This is the object to be intercepted. |
Constructor Summary | |
---|---|
InterceptorItem(java.lang.Object item,
java.lang.Object interceptor)
This creates the object, to intercept the target object's calls. |
Method Summary | |
---|---|
java.lang.Object |
invoke(java.lang.String method,
java.lang.Object args)
This method intercepts the incoming calls. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.Object interceptor
public final java.lang.Object item
public static final java.lang.Object CONTINUE
Constructor Detail |
---|
public InterceptorItem(java.lang.Object item, java.lang.Object interceptor)
item
- The object to receive the client invocation. It can be
local, remote, or even a proxy.interceptor
- The object to receive the calls prior to the
intercepted item's operation. It can be local, remote, or even a proxy.Method Detail |
---|
public java.lang.Object invoke(java.lang.String method, java.lang.Object args) throws java.lang.Exception
InterceptorItem.CONTINUE
object, indicating that the intercepted object should process the
invocation.
Note: if the interceptor object does not have a method comparably matching what is being invoked, it will be automatically passed on to the intercepted object. This allows the interceptor to define only the methods it wishes to potentially override/except.
invoke
in interface Invoke
method
- The intercepted object's public method being called.args
- The arguments being passed to the intercepted object's
method.
java.lang.NoSuchMethodException
- If the method/agruments signature cannot
be matched to the internal object's public method interface.
java.rmi.RemoteException
- For any network realated failures.
java.lang.Exception
- If the interceptor object's method rejects the
invocation, or if it has been rejected by the intercepted object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |