The JNI Bridge Generator allows you to generate C++ proxies for Java classes, using Java Annotation Processors and Velocity templates.
The JNIBridgeGenerator is licensed under the Apache License, v2: http://www.apache.org/licenses/LICENSE-2.0.html.
No. The JNI Bridge Generator is designed to make the development of Java/C++ applications as easy as possible:
- Generate the bindings while writing your Java code
- One annotation to rule them all: no complex configuration, just use a single annotation
- Focus on your problems and use Java classes transparantly in C++.
The JNIBridgeGenerator generates C++ proxies for
- public Java classes,
- public methods.
The generated classes allow you to use the Java classes in your C++ applications as if they were normal C++ classes. You can create them, delete them, even inherit them.
These features are in progress:
- Generics, mapping to C++ templates
- Interfaces, supporting C++ implementation of a Java interface.
Add the @JNIProxy
annotation on
- Classes
- Constructors
- Methods
to generate C++ proxies at compile time.
package com.tecnyse.sample.integration;
import com.tecnyse.integration.JNIProxy;
@JNIProxy
public class MyClass {
@JNIProxy
public int foo() {
return 1;
}
@JNIProxy
public static String bar(int arg1, String arg2) {
return arg2 + arg1;
}
}
The above will generate 2 files in com/tecnyse/samples/integration
(the package):
myclass.h
: declares the JNI proxy forMyClass
as a C++ class in thecom::tecnyse::samples::integration
namespace.myclass.cpp
: defines the JNI bindings for MyClass.
- JNIBridgeGenerator: the IntelliJ module for the generator
- test: an IntelliJ module with samples.
- Put the JNIBridgeGenerator jar on your classpath
- Add the
com.tecnyse.integration.processor.JNIProxyProcessor
processor in your services manifest. - Annotate.
- Compile!