|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.weblite.objc.Proxy
public class Proxy
A wrapper around a native (Objective-C) object that allows for sending messages from Java.
The following snippet is taken from a unit test, to give you an idea of how to use the Proxy class to wrap an Objective-C object.
The NSRange object is a structure that we define in Java to correspond with the NSRange objective-c structure according to JNA conventions. It's implementation (for your reference) was:
| Constructor Summary | |
|---|---|
Proxy()
Creates a proxy for a Null pointer. |
|
Proxy(Client client)
Creates a proxy for a Null pointer using the specified Client object. |
|
Proxy(Client client,
com.sun.jna.Pointer peer)
Creates a proxy for the specified peer Objective-C object, using the specified client to send messages to the peer. |
|
Proxy(com.sun.jna.Pointer peer)
Creates a proxy for the specified peer Objective-C object. |
|
| Method Summary | |
|---|---|
Proxy |
chain(Message... msgs)
Deprecated. |
Proxy |
chain(com.sun.jna.Pointer selector,
Object... args)
Deprecated. |
Proxy |
chain(String selector,
Object... args)
Deprecated. |
void |
dispose(boolean sendDeallocMessage)
Removes the proxy from the proxy cache, and optionally sends a dealloc message to the peer. |
static void |
drainCache()
|
boolean |
equals(Object o)
Compares this object to another Peerable object. |
Object |
get(String key)
Wrapper for key-value coding. |
boolean |
getBoolean(String key)
Returns the KVC coded value for the specified key as a boolean. |
Client |
getClient()
Returns the client that is used by this Proxy object. |
double |
getDouble(String key)
Returns the KVC coded value for the specified key as a double. |
int |
getInt(String key)
Returns the KVC coded value for the specified key as an int. |
com.sun.jna.Pointer |
getPeer()
Returns the Pointer to the native peer object. |
com.sun.jna.Pointer |
getPointer(String key)
Returns the KVC coded value for the specified key as a Pointer. |
Proxy |
getProxy(String key)
Returns the KVC coded value for the specified key as a Proxy. |
int |
hashCode()
|
static Proxy |
load(com.sun.jna.Pointer peer)
Loads a proxy object for the specified pointer to an objective-c object. |
static Object |
release(Object obj)
Releases the Proxy object from the Cache. |
static Object |
retain(Object obj)
Retains the Proxy object in the Cache. |
Object |
send(Message... msgs)
Sends a message to the peer. |
Object |
send(com.sun.jna.Pointer selector,
Object... args)
Sends a message to the peer. |
Object |
send(String selector,
Object... args)
Sends a message to the peer. |
boolean |
sendBoolean(com.sun.jna.Pointer selector,
Object... args)
A wrapper for the send() method, that returns a boolean. |
boolean |
sendBoolean(String selector,
Object... args)
A wrapper for the send() method, that returns a boolean. |
double |
sendDouble(com.sun.jna.Pointer selector,
Object... args)
A wrapper for the send() method, that returns a double. |
double |
sendDouble(String selector,
Object... args)
A wrapper for the send() method, that returns a double. |
int |
sendInt(com.sun.jna.Pointer selector,
Object... args)
A wrapper for the send() method, that returns an int. |
int |
sendInt(String selector,
Object... args)
A wrapper for the send() method, that returns an int. |
com.sun.jna.Pointer |
sendPointer(com.sun.jna.Pointer selector,
Object... args)
A wrapper for the send() method, that returns a Pointer. |
com.sun.jna.Pointer |
sendPointer(String selector,
Object... args)
A wrapper for the send() method, that returns a Pointer. |
Proxy |
sendProxy(com.sun.jna.Pointer selector,
Object... args)
A wrapper for the send() method, that returns a Pointer. |
Proxy |
sendProxy(String selector,
Object... args)
A wrapper for the send() method, that returns a Pointer. |
Object |
sendRaw(Message... msgs)
Sends a message to the peer without performing any type coercion to the inputs or outputs. |
Object |
sendRaw(com.sun.jna.Pointer selector,
Object... args)
Sends a message to the peer. |
Object |
sendRaw(String selector,
Object... args)
Sends a message to the peer without performing any type coercion to the inputs or outputs. |
String |
sendString(com.sun.jna.Pointer selector,
Object... args)
|
String |
sendString(String selector,
Object... args)
|
void |
set(String key,
Object value)
Wrapper for Key-Value coding. |
Proxy |
setClient(Client client)
Sets the client that should be used for sending messages to the peer object. |
void |
setPeer(com.sun.jna.Pointer peer)
Sets the pointer to the native peer object. |
String |
toString()
Outputs the object as a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Proxy()
public Proxy(Client client)
client -
public Proxy(Client client,
com.sun.jna.Pointer peer)
client - peer - public Proxy(com.sun.jna.Pointer peer)
peer - | Method Detail |
|---|
public static Object retain(Object obj)
obj - The object that is being retained. If the object is a Proxy
object, then its retainCount will be incremented.
public static Object release(Object obj)
obj - The object that is being released. If the object is a Proxy
object, then its retainCount will be decremented, and, if it is zero,
will be removed from the proxy cache.
public static void drainCache()
public static Proxy load(com.sun.jna.Pointer peer)
Note: This will perform a retain() on the Proxy object, so you should release it when you are done with it to remove it from the cache.
peer - The objective-c peer object.
public void dispose(boolean sendDeallocMessage)
sendDeallocMessage - IF true, then this will also send a dealloc message
to the peer. If false, then it will simply remove from the Proxy cache, but
leave the Objective-C object intact.
public com.sun.jna.Pointer sendPointer(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public com.sun.jna.Pointer sendPointer(String selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public Proxy sendProxy(String selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public Proxy sendProxy(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public String sendString(com.sun.jna.Pointer selector,
Object... args)
public String sendString(String selector,
Object... args)
public int sendInt(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public int sendInt(String selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public double sendDouble(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public double sendDouble(String selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public boolean sendBoolean(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public boolean sendBoolean(String selector,
Object... args)
selector - The selector to call on the peer.args - Variable argument list.
public Object send(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to send to.args - Variable argument list.
public Object send(String selector,
Object... args)
selector - The selector to send to.args - Variable argument list.
public Object send(Message... msgs)
selector - The selector to send to.args - Variable argument list.
public Object sendRaw(com.sun.jna.Pointer selector,
Object... args)
selector - The selector to send to.args - Variable argument list.
public Object sendRaw(String selector,
Object... args)
selector - The selector to send to.args - Variable argument list.
public Object sendRaw(Message... msgs)
selector - The selector to send to.args - Variable argument list.
public Proxy chain(com.sun.jna.Pointer selector,
Object... args)
selector - args -
public Proxy chain(String selector,
Object... args)
selector - args -
public Proxy chain(Message... msgs)
msgs -
public Client getClient()
public Proxy setClient(Client client)
client -
public com.sun.jna.Pointer getPeer()
getPeer in interface Peerablepublic void setPeer(com.sun.jna.Pointer peer)
setPeer in interface Peerablepeer - public String toString()
toString in class Objectpublic boolean equals(Object o)
equals in class Objecto -
public int hashCode()
hashCode in class Object
public void set(String key,
Object value)
key - value - public Object get(String key)
key -
public int getInt(String key)
key -
public boolean getBoolean(String key)
key -
public Proxy getProxy(String key)
key -
public double getDouble(String key)
key -
public com.sun.jna.Pointer getPointer(String key)
key -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||