
ca.weblite.objc.mappers.PointerMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-objc-bridge Show documentation
Show all versions of java-objc-bridge Show documentation
A thin bridge that allows for two-way communication from Java to Objective-C.
package ca.weblite.objc.mappers;
import com.sun.jna.Pointer;
import ca.weblite.objc.TypeMapping;
/**
* PointerMapping class.
*
* @author shannah
* @version $Id: $Id
* @since 1.1
*/
public class PointerMapping implements TypeMapping {
/**
* Singleton instance.
*/
public static final PointerMapping INSTANCE = new PointerMapping();
private PointerMapping() { }
@Override
public Object cToJ(Object cVar, String signature, TypeMapping root) {
if (cVar instanceof Pointer) return cVar;
return new Pointer((Long) cVar);
}
@Override
public Object jToC(Object jVar, String signature, TypeMapping root) {
// After some difficult deliberation I've decided that it is
// better to require a Pointer or long to be passed in places
// where Objective-C expects a pointer.
return jVar;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy