Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use class mapping instead of interface mapping

  • Loading branch information...
commit 8d7a1302799a7a6966305f5584e8bc0d9574b333 1 parent 46ebee5
@samstokes samstokes authored
View
39 src/main/java/com/rapportive/jawbone/JawboneBinding.java
@@ -1,40 +1,41 @@
package com.rapportive.jawbone;
-import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.LongByReference;
import com.sun.jna.ptr.PointerByReference;
-public interface JawboneBinding extends Library {
- JawboneBinding INSTANCE = (JawboneBinding) Native.loadLibrary("wbxml2", JawboneBinding.class);
+public class JawboneBinding {
+ static {
+ Native.register("wbxml2");
+ }
- int wbxml_conv_wbxml2xml_create(PointerByReference convPtr);
+ public native int wbxml_conv_wbxml2xml_create(PointerByReference convPtr);
- void wbxml_conv_wbxml2xml_set_gen_type(Pointer conv, int genType);
- void wbxml_conv_wbxml2xml_set_language(Pointer conv, int language);
- void wbxml_conv_wbxml2xml_set_charset(Pointer conv, int charset);
- void wbxml_conv_wbxml2xml_set_indent(Pointer conv, int indent);
- void wbxml_conv_wbxml2xml_enable_preserve_whitespaces(Pointer conv);
+ public native void wbxml_conv_wbxml2xml_set_gen_type(Pointer conv, int genType);
+ public native void wbxml_conv_wbxml2xml_set_language(Pointer conv, int language);
+ public native void wbxml_conv_wbxml2xml_set_charset(Pointer conv, int charset);
+ public native void wbxml_conv_wbxml2xml_set_indent(Pointer conv, int indent);
+ public native void wbxml_conv_wbxml2xml_enable_preserve_whitespaces(Pointer conv);
- int wbxml_conv_wbxml2xml_run(Pointer conv, byte[] wbxml, long wbxmlLength, PointerByReference xmlPtr, LongByReference xmlLength);
+ public native int wbxml_conv_wbxml2xml_run(Pointer conv, byte[] wbxml, long wbxmlLength, PointerByReference xmlPtr, LongByReference xmlLength);
- void wbxml_conv_wbxml2xml_destroy(Pointer conv);
+ public native void wbxml_conv_wbxml2xml_destroy(Pointer conv);
- int wbxml_conv_xml2wbxml_create(PointerByReference convPtr);
+ public native int wbxml_conv_xml2wbxml_create(PointerByReference convPtr);
- void wbxml_conv_xml2wbxml_set_version(Pointer conv, int version);
- void wbxml_conv_xml2wbxml_enable_preserve_whitespaces(Pointer conv);
- void wbxml_conv_xml2wbxml_disable_string_table(Pointer conv);
- void wbxml_conv_xml2wbxml_disable_public_id(Pointer conv);
+ public native void wbxml_conv_xml2wbxml_set_version(Pointer conv, int version);
+ public native void wbxml_conv_xml2wbxml_enable_preserve_whitespaces(Pointer conv);
+ public native void wbxml_conv_xml2wbxml_disable_string_table(Pointer conv);
+ public native void wbxml_conv_xml2wbxml_disable_public_id(Pointer conv);
- int wbxml_conv_xml2wbxml_run(Pointer conv, byte[] xml, long xmlLength, PointerByReference wbxmlPtr, LongByReference wbxmlLength);
+ public native int wbxml_conv_xml2wbxml_run(Pointer conv, byte[] xml, long xmlLength, PointerByReference wbxmlPtr, LongByReference wbxmlLength);
- void wbxml_conv_xml2wbxml_destroy(Pointer conv);
+ public native void wbxml_conv_xml2wbxml_destroy(Pointer conv);
- String wbxml_errors_string(int ret);
+ public native String wbxml_errors_string(int ret);
}
View
2  src/test/java/com/rapportive/jawbone/JawboneTest.java
@@ -29,7 +29,7 @@ public static void setUpBeforeClass() throws Exception {
wbxml = readFile(testResource("activesync-001-settings_device_information.wbxml"));
xml = readFile(testResource("activesync-001-settings_device_information.xml"));
- binding = JawboneBinding.INSTANCE;
+ binding = new JawboneBinding();
}
@Test
Please sign in to comment.
Something went wrong with that request. Please try again.