Changing Method Names

ObjectiveCName Annotation

You can annotate any Java method with @ObjectiveCName to change the translated name of that method and any method that overrides it. For example:

public void setTime(int hours, int minutes, int seconds) {

is translated as:

- (void)setTimeWithHours:(jint)hours

Mapping File

Method names can be changed using the --mapping flag, which takes a properties file with the mappings to use. Each method mapping is defined with the full Java method signature for the key, and a Objective-C declaration value. For example, the line to map Object.equals() to NSObject.isEqual: is:

java.lang.Object.equals(Ljava/lang/Object;)Z = NSObject isEqual:(id)anObject

The left hand declaration is the full method signature, as defined by the Java Virtual Machine Specification. The right hand definition consists of the iOS class, followed by the message's declaration. The method and its mapping must have the same parameters, in the same order.

Additional mapping files can be specified on the command-line, using the --mapping option.