|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.weblite.objc.Proxy
ca.weblite.objc.NSObject
public class NSObject
The base class for objects that can interact with the Objective-C runtime. NSObjects are connected to both an Objective-C peer object, and an Objective-C parent object. The peer is a reflection of the object in Objective-C. It is a WLProxy object that will simply forward messages from Objective-C to Java.
The parent object is used as a sort of superclass so that messages that aren't explicitly handled by the Java class can be handled by the superclass.
The following example shows a subclass of NSObject that is used as a delegate for an NSOpenPanel. Notice, that, by using the @Msg annotation, the start() method is effectively called via Objective-C. Similarly, the panelSelectionDidChange() method is called by the NSOpenPanel class to respond to events when the user clicks on a different item in the open dialog.
If you run this application, it will open an NSOpenPanel modal dialog and allow you to select a file. If you run this program and select a single file, the output will look something like:
NSOpenPanelSample| Field Summary | |
|---|---|
com.sun.jna.Pointer |
parent
Pointer to the parent objective-c object of this object. |
| Constructor Summary | |
|---|---|
NSObject()
Creates null proxy (i.e. |
|
NSObject(Client c)
Creates a null proxy using the specified client as the default client with which to send messages to the objective-c runtime. |
|
NSObject(Client c,
com.sun.jna.Pointer peer)
Creates a proxy for the specified objective-c object. |
|
NSObject(com.sun.jna.Pointer peer)
Creates an NSObject to wrap (i.e. |
|
NSObject(String className)
|
|
| Method Summary | |
|---|---|
NSObject |
chain(Message... msgs)
Deprecated. |
NSObject |
chain(com.sun.jna.Pointer selector,
Object... args)
Deprecated. |
NSObject |
chain(String selector,
Object... args)
Deprecated. |
NSObject |
dealloc()
Deprecated. |
void |
forwardInvocation(long linvocation)
Handles a method invocation. |
void |
forwardInvocation(com.sun.jna.Pointer invocation)
Handles a method invocation. |
void |
forwardInvocationToParent(long linvocation)
Forwards an NSInvocation to the parent object to be handled. |
void |
forwardInvocationToParent(com.sun.jna.Pointer invocation)
Forwards an NSInvocation to the parent object to be handled. |
protected static Map<String,Method> |
getMethodMap(Class cls)
Returns the method map for a particular class. |
NSObject |
init(com.sun.jna.Pointer parent)
Initializes this object and registers it with the Objective-C runtime. |
NSObject |
init(String cls)
Initializes this object and registers it with the Objective-C runtime. |
Method |
methodForSelector(String selector)
Returns the java method that responds to a specific selector for the current object. |
long |
methodSignatureForSelector(long lselector)
Returns the NSMethodSignature (Objective-C) object pointer for the specified selector. |
com.sun.jna.Pointer |
methodSignatureForSelector(com.sun.jna.Pointer selector)
Returns the NSMethodSignature (Objective-C) object pointer for the specified selector. |
boolean |
respondsToSelector(long lselector)
Checks whether this object responds to the given selector. |
boolean |
respondsToSelector(com.sun.jna.Pointer selector)
Checks whether this object responds to the given selector. |
| Methods inherited from class ca.weblite.objc.Proxy |
|---|
dispose, drainCache, equals, get, getBoolean, getClient, getDouble, getInt, getPeer, getPointer, getProxy, hashCode, load, release, retain, send, send, send, sendBoolean, sendBoolean, sendDouble, sendDouble, sendInt, sendInt, sendPointer, sendPointer, sendProxy, sendProxy, sendRaw, sendRaw, sendRaw, sendString, sendString, set, setClient, setPeer, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ca.weblite.objc.Peerable |
|---|
getPeer, setPeer |
| Field Detail |
|---|
public com.sun.jna.Pointer parent
| Constructor Detail |
|---|
public NSObject(String className)
public NSObject()
public NSObject(com.sun.jna.Pointer peer)
peer - public NSObject(Client c)
c - The client that should be used to send messages in this
object.
public NSObject(Client c,
com.sun.jna.Pointer peer)
c - The client that should be used for sending messages via this proxy.peer - The peer object.| Method Detail |
|---|
protected static Map<String,Method> getMethodMap(Class cls)
cls - The class whose map we wish to obtain
public NSObject init(com.sun.jna.Pointer parent)
parent - A pointer to a parent object that is used as a sort of
super class. I.e. messages that this object doesn't handle will be
passed to this parent object transparently in the background. It
acts 100% as a superclass would.
public NSObject init(String cls)
parent - A pointer to a parent object that is used as a sort of
super class. I.e. messages that this object doesn't handle will be
passed to this parent object transparently in the background. It
acts 100% as a superclass would.cls - The name of the class to use as the super class for this object.
public Method methodForSelector(String selector)
selector - The
RuntimeUtils.sel()public com.sun.jna.Pointer methodSignatureForSelector(com.sun.jna.Pointer selector)
selector -
public long methodSignatureForSelector(long lselector)
methodSignatureForSelector in interface Recipientselector -
public void forwardInvocationToParent(com.sun.jna.Pointer invocation)
invocation - Pointer to the objective-c NSInvocation object.public void forwardInvocationToParent(long linvocation)
invocation - Pointer to the objective-c NSInvocation object.public void forwardInvocation(com.sun.jna.Pointer invocation)
invocation - NSInvocation Objective-C object that is to be invoked.public void forwardInvocation(long linvocation)
forwardInvocation in interface Recipientinvocation - NSInvocation Objective-C object that is to be invoked.public boolean respondsToSelector(com.sun.jna.Pointer selector)
selector - Pointer to the selector to check.
RuntimeUtils.sel(),
Objective-C selectors referencepublic boolean respondsToSelector(long lselector)
respondsToSelector in interface Recipientselector - Pointer to the selector to check.
RuntimeUtils.sel(),
Objective-C selectors reference
public NSObject chain(com.sun.jna.Pointer selector,
Object... args)
chain in class Proxyselector - args -
public NSObject chain(String selector,
Object... args)
chain in class Proxyselector - args -
public NSObject chain(Message... msgs)
chain in class Proxymsgs -
public NSObject dealloc()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||