|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.weblite.objc.TypeMapper
public class TypeMapper
Maps Objective-C types to Java types. This provides automatic conversion to message inputs and outputs (unless coercion is disabled in the message request). In many cases, it just passes the values straight through (e.g. primitive types. Notably, Java Strings are mapped to NSStrings if the signature of the argument context is an NSString, and NSObjects are mapped as Proxy wrapper objects.
| Constructor Summary | |
|---|---|
TypeMapper()
|
|
| Method Summary | |
|---|---|
TypeMapper |
addMapping(TypeMapping mapping,
String... signatures)
Adds a TypeMapping that is meant to handle one or more signatures. |
Object |
cToJ(Object cVar,
String signature,
TypeMapping root)
Converts a C variable to the corresponding Java type based on the specified signature. |
static TypeMapper |
getInstance()
Obtains the singleton instance of the TypeMapper |
Object |
jToC(Object jVar,
String signature,
TypeMapping root)
Converts a Java variable to the corresponding C type based on the specified signature. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TypeMapper()
| Method Detail |
|---|
public static TypeMapper getInstance()
public TypeMapper addMapping(TypeMapping mapping,
String... signatures)
mapping - The TypeMapping object meant to handle conversions for
the given signatures.signatures - One or more signatures following Objective-C type encodings.
public Object cToJ(Object cVar,
String signature,
TypeMapping root)
cToJ in interface TypeMappingcVar - The C variable that is to be converted.signature - The signature that provides the context of what
the variable is expected to be in the Objective-C runtime. This
follows Objective-C type encoding conventions.root - This should be the root TypeMapping. Usually you just pass
TypeMapper.getInstance() here.
public Object jToC(Object jVar,
String signature,
TypeMapping root)
The following is a modified snippet from the NSObject class that shows (roughly) how the jToC method is used to take the output of a Java method and set the return value in an NSInvocation object to a corresponding C type.:
jToC in interface TypeMappingjVar - The C variable that is to be converted.signature - The signature that provides the context of what
the variable is expected to be in the Objective-C runtime. This
follows Objective-C type encoding conventions.root - This should be the root TypeMapping. Usually you just pass
TypeMapper.getInstance() here.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||