|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgnu.cajo.utils.extra.DynamicObject
public final class DynamicObject
This is a dynamic server object dispatcher. Its purpose it to provide a client with a single remote object reference, whose functionality can be changed by the server at runtime. A server would remote this object wrapper, then use its changeObject method to redefine the functionality of the client's reference dynamically. Note: the wrapped object can be of any type, and it need not even implement the gnu.cajo.invoke.Invoke interface.
While being only 5 lines of Java source code, its capability is elegantly sophisticated.
| Constructor Summary | |
|---|---|
DynamicObject(java.lang.Object object)
The constructor assigns the initial server object reference. |
|
| Method Summary | |
|---|---|
void |
changeObject(java.lang.Object object)
This method is used to dynamically redefine the functionality of this wrapper at runtime. |
java.lang.Object |
invoke(java.lang.String method,
java.lang.Object args)
This method simply redirects all invocations to the currently wrapped object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DynamicObject(java.lang.Object object)
object - The initial encapsulated server functionality to be
remoted through this object.| Method Detail |
|---|
public java.lang.Object invoke(java.lang.String method,
java.lang.Object args)
throws java.lang.Exception
invoke in interface Invokemethod - The method name to be invoked on the wrapped object.args - The arguments to provide to the method for its invocation.
java.lang.NoSuchMethodException - If no matching method can be found.
java.lang.Exception - If the wrapped object rejected the invocation, for
application specific reasons.public void changeObject(java.lang.Object object)
object - The new encapsulated functionality to be provided to
the remote clients.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||