|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||
@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Msg
An annotation that allows a Java method to receive and process Objective-C messages. This annotation is only useful for subclasses of ca.weblite.objc.NSObject.
The following is some test code that uses the TestClass. Notice that this class can be interacted with the same as if it was an Objective-C object. Indeed, Objective-C can call any of the methods marked by the @Msg annotation by simply sending it the appropriate message.
| Required Element Summary | |
|---|---|
String |
selector
The name of the objective-c selector that can be used to target this method. |
| Optional Element Summary | |
|---|---|
String |
like
Specifies that the signature should match that of another object's method. |
String |
signature
The signature of this message. |
| Element Detail |
|---|
public abstract String selector
public abstract String signature
| Method Type | Signature | Explanation |
|---|---|---|
| Returns NSString, takes no parameters | @@: | The first "@" indicates the return value, which is an Object, The second "@" is a mandatory hidden parameter that refers to the receiver of the message. The ":" is a hidden parameter that refers to the selector of the message. |
| Returns void, takes an NSString as a parameter | v@:@ | The "v" indicates that there is no return value (i.e. void). The first "@" marks the hidden parameter that is the target of the message. The ":" marks the hidden selector. The final "@" indicates that it takes an object as a parameter (specifically an NSString, but the signature doesn't distinguish. |
| Returns void, takes an C String (i.e. *char) as a parameter | v@:* | The "v" indicates that there is no return value (i.e. void). The first "@" marks the hidden parameter that is the target of the message. The ":" marks the hidden selector. The final "*" indicates that it takes a C String as the first parameter. |
public abstract String like
E.g., if you have a method that takes no input, and returns an int,
you might just say that your method is like the NSArray.count selector:
{@literal @}Msg(selector="myIntMessage", like="NSArray.count")
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT | |||||||||