public final class DynamicObject extends Object implements Invoke
While being only 5 lines of Java source code, its capability is elegantly sophisticated.
| Constructor and Description |
|---|
DynamicObject(Object object)
The constructor assigns the initial server object reference.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeObject(Object object)
This method is used to dynamically redefine the functionality of
this wrapper at runtime.
|
Object |
invoke(String method,
Object args)
This method simply redirects all invocations to the currently wrapped
object.
|
public DynamicObject(Object object)
object - The initial encapsulated server functionality to be
remoted through this object.public Object invoke(String method, Object args) throws 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.NoSuchMethodException - If no matching method can be found.Exception - If the wrapped object rejected the invocation, for
application specific reasons.public void changeObject(Object object)
object - The new encapsulated functionality to be provided to
the remote clients.Copyright © 2016. All Rights Reserved.