Comparing version
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"engines": { | ||
@@ -13,0 +13,0 @@ "node": ">=0.6.0" |
@@ -101,2 +101,4 @@ # java | ||
* [newByte](#javaNewByte) | ||
* [newShort](#javaNewShort) | ||
* [newChar](#javaNewChar) | ||
* [newProxy](#javaNewProxy) | ||
@@ -232,2 +234,28 @@ | ||
<a name="javaNewShort" /> | ||
**java.newShort(val)** | ||
Creates a new java short. This is needed because javascript does not have the concept of a short. | ||
__Arguments__ | ||
* val - The value of the java short. | ||
__Example__ | ||
var s = java.newShort(12); | ||
<a name="javaNewChar" /> | ||
**java.newChar(val)** | ||
Creates a new java char. This is needed because javascript does not have the concept of a char. | ||
__Arguments__ | ||
* val - The value of the java char. | ||
__Example__ | ||
var ch = java.newChar('a'); | ||
<a name="javaNewProxy" /> | ||
@@ -234,0 +262,0 @@ **java.newProxy(interfaceName, functions)** |
@@ -141,2 +141,68 @@ var java = require("../testHelpers").java; | ||
test.done(); | ||
}, | ||
"method taking a byte": function(test) { | ||
var b = java.newByte(1); | ||
test.equal('java.lang.Byte', b.getClassSync().getNameSync()); | ||
test.equal('1', b.toStringSync()); | ||
var r = java.callStaticMethodSync("Test", "staticByte", b); | ||
console.log(r); | ||
test.equal(r, 1); | ||
test.done(); | ||
}, | ||
"method taking a char (number)": function(test) { | ||
var ch = java.newChar(97); // 'a' | ||
test.equal('java.lang.Character', ch.getClassSync().getNameSync()); | ||
test.equal('a', ch.toStringSync()); | ||
var r = java.callStaticMethodSync("Test", "staticChar", ch); | ||
console.log(r); | ||
test.equal(r, 97); | ||
test.done(); | ||
}, | ||
"method taking a char (string)": function(test) { | ||
var ch = java.newChar('a'); | ||
test.equal('java.lang.Character', ch.getClassSync().getNameSync()); | ||
test.equal('a', ch.toStringSync()); | ||
var r = java.callStaticMethodSync("Test", "staticChar", ch); | ||
console.log(r); | ||
test.equal(r, 97); | ||
test.done(); | ||
}, | ||
"new boolean array object": function(test) { | ||
var booleanArray = java.newArray("java.lang.Boolean", [true, false]); | ||
var r = java.callStaticMethodSync("Test", "staticBooleanArray", booleanArray); | ||
test.equal(r.length, 2); | ||
test.equal(r[0], true); | ||
test.equal(r[1], false); | ||
test.done(); | ||
}, | ||
"new boolean array": function(test) { | ||
var booleanArray = java.newArray("boolean", [true, false]); | ||
var r = java.callStaticMethodSync("Test", "staticBooleanArray", booleanArray); | ||
test.equal(r.length, 2); | ||
test.equal(r[0], true); | ||
test.equal(r[1], false); | ||
test.done(); | ||
}, | ||
"new short array objects": function(test) { | ||
var shortArray = java.newArray("java.lang.Short", [1, 2].map(function(c) { return java.newShort(c); })); | ||
var r = java.callStaticMethodSync("Test", "staticShortArray", shortArray); | ||
test.equal(r.length, 2); | ||
test.equal(r[0], 1); | ||
test.equal(r[1], 2); | ||
test.done(); | ||
}, | ||
"new short array": function(test) { | ||
var shortArray = java.newArray("short", [1, 2]); | ||
var r = java.callStaticMethodSync("Test", "staticShortArray", shortArray); | ||
test.equal(r.length, 2); | ||
test.equal(r[0], 1); | ||
test.equal(r[1], 2); | ||
test.done(); | ||
} | ||
@@ -143,0 +209,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2261694
0.4%975
9.06%346
8.81%