Skip to content

geertcl/JNIBridgeGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JNIBridgeGenerator

The JNI Bridge Generator allows you to generate C++ proxies for Java classes, using Java Annotation Processors and Velocity templates.

License

The JNIBridgeGenerator is licensed under the Apache License, v2: http://www.apache.org/licenses/LICENSE-2.0.html.

Yet Another ...?

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++.

Features

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.

Usage

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 for MyClass as a C++ class in the com::tecnyse::samples::integration namespace.
  • myclass.cpp: defines the JNI bindings for MyClass.

Repository structure

  • JNIBridgeGenerator: the IntelliJ module for the generator
  • test: an IntelliJ module with samples.

Getting Started

  • Put the JNIBridgeGenerator jar on your classpath
  • Add the com.tecnyse.integration.processor.JNIProxyProcessor processor in your services manifest.
  • Annotate.
  • Compile!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published