public final class AsyncMethod extends Object implements Invoke
This class can be used in either of two fundamentally different ways:
| Modifier and Type | Field and Description |
|---|---|
Object |
callback
This is the reference to the object, local or remote, which to call
back asynchronously, when the invocation has completed.
|
Object |
item
This is the reference to the object, usually remote, on which to
invoke asynchronously.
|
| Constructor and Description |
|---|
AsyncMethod(Object item,
Object callback)
The constructor takes any object, and allows its methods to be
invoked asynchronously; then calls back the listening object, with the
result of the invocation.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
invoke(Object item,
String method,
Object args,
Object callback)
This method invokes the method specified, on the object specified,
with the argument(s) specified, if any, asynchronously.
|
Object |
invoke(String method,
Object args)
This method invokes the method specified, with the argument(s)
specified, if any, asynchronously.
|
public final Object item
public final Object callback
public AsyncMethod(Object item, Object callback)
item - The object to make asynchronously callable. It may be an
any arbitrary object, of any type, local or remote.callback - The object to asynchronously call back, on the
completion of the asynchronous method call. It may be any arbitrary
object, of any type, local or remote. If the argument is null, the
asynchronous invocations result will silently be silently discarded.public Object invoke(String method, Object args)
invoke in interface Invokemethod - The name of the method of the member object to be
invoked asynchronously.args - The argument, or arguments, to be provided to the method.
The paramater can be null, if the method takes none, or it can be
an array of objects, if the method takes several. In actuality,
this method simply invokes the static invoke method of this class,
providing its local item and callback objects, to centralise the
asynchronous invocation processing.public static void invoke(Object item, String method, Object args, Object callback)
item - The object on which to invoke the method asynchronously.
It may be any arbitrary object, of any type, local or remote.method - The name of the method on the called object to be
invoked asynchronously.args - The argument, or arguments, to be provided to the method.
The paramater can be null, if the method takes none, or it can be
an array of objects, when the method takes several.callback - The object to asynchronously call back, on the
completion of the asynchronous method call. It may be any arbitrary
object, of any type, local or remote. If the argument is null, the
invocation result will be silently discarded.Copyright © 2016. All Rights Reserved.