public abstract class Adapter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Adapter.Callback
A callback that returns the HTTP response body.
|
static class |
Adapter.JsonArrayCallback
A callback that returns a JSON array.
|
static class |
Adapter.JsonCallback
A callback that parses a JSON response.
|
static class |
Adapter.JsonObjectCallback
A callback that returns a JSON object.
|
| Constructor and Description |
|---|
Adapter(android.content.Context context)
Creates a new, disconnected Adapter.
|
Adapter(android.content.Context context,
java.lang.String url)
Creates a new Adapter, connecting it to `url`.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
connect(android.content.Context context,
java.lang.String url)
Connects the Adapter to `url`.
|
abstract void |
invokeInstanceMethod(java.lang.String method,
java.util.Map<java.lang.String,? extends java.lang.Object> constructorParameters,
java.util.Map<java.lang.String,? extends java.lang.Object> parameters,
Adapter.Callback callback)
Invokes a remotable method exposed within a prototype on the server.
|
abstract void |
invokeStaticMethod(java.lang.String method,
java.util.Map<java.lang.String,? extends java.lang.Object> parameters,
Adapter.Callback callback)
Invokes a remotable method exposed statically on the server.
|
abstract boolean |
isConnected()
Gets whether this adapter is connected to a server.
|
public Adapter(android.content.Context context)
public Adapter(android.content.Context context,
java.lang.String url)
url - The URL to connect to.public abstract void connect(android.content.Context context,
java.lang.String url)
url - The URL to connect to.public abstract boolean isConnected()
true if connected, false otherwise.public abstract void invokeStaticMethod(java.lang.String method,
java.util.Map<java.lang.String,? extends java.lang.Object> parameters,
Adapter.Callback callback)
Unlike invokeInstanceMethod(String, Map, Map, Callback), no
object needs to be created on the server.
method - The method to invoke, e.g.
"module.doSomething".parameters - The parameters to invoke with.callback - The callback to invoke when the execution finishes.public abstract void invokeInstanceMethod(java.lang.String method,
java.util.Map<java.lang.String,? extends java.lang.Object> constructorParameters,
java.util.Map<java.lang.String,? extends java.lang.Object> parameters,
Adapter.Callback callback)
This should be thought of as a two-step process. First, the server loads or creates an object with the appropriate type. Then and only then is the method invoked on that object. The two parameter dictionaries correspond to these two steps: `creationParameters` for the former, and `parameters` for the latter.
method - The method to invoke, e.g.
"MyClass.prototype.doSomething".constructorParameters - The parameters the virtual object should be
created with.parameters - The parameters to invoke with.callback - The callback to invoke when the execution finishes.