@@ -64,9 +64,9 @@ public class BoxStore implements Closeable {
6464 @ Nullable public static Object relinker ;
6565
6666 /** Change so ReLinker will update native library when using workaround loading. */
67- public static final String JNI_VERSION = "2.4.0 " ;
67+ public static final String JNI_VERSION = "2.4.1 " ;
6868
69- private static final String VERSION = "2.4.0 -2019-10-03 " ;
69+ private static final String VERSION = "2.4.1 -2019-10-29 " ;
7070 private static BoxStore defaultStore ;
7171
7272 /** Currently used DB dirs with values from {@link #getCanonicalPath(File)}. */
@@ -999,4 +999,23 @@ long panicModeRemoveAllObjects(int entityId) {
999999 return nativePanicModeRemoveAllObjects (handle , entityId );
10001000 }
10011001
1002+ /**
1003+ * If you want to use the same ObjectBox store using the C API, e.g. via JNI, this gives the required pointer,
1004+ * which you have to pass on to obx_store_wrap().
1005+ * The procedure is like this:<br>
1006+ * 1) you create a BoxStore on the Java side<br>
1007+ * 2) you call this method to get the native store pointer<br>
1008+ * 3) you pass the native store pointer to your native code (e.g. via JNI)<br>
1009+ * 4) your native code calls obx_store_wrap() with the native store pointer to get a OBX_store pointer<br>
1010+ * 5) Using the OBX_store pointer, you can use the C API.
1011+ *
1012+ * Note: Once you {@link #close()} this BoxStore, do not use it from the C API.
1013+ */
1014+ public long getNativeStore () {
1015+ if (closed ) {
1016+ throw new IllegalStateException ("Store must still be open" );
1017+ }
1018+ return handle ;
1019+ }
1020+
10021021}
0 commit comments