Permalink
Browse files

changed require to import

  • Loading branch information...
1 parent 1e33573 commit 9510862504cd423208614a2e114471c1ef3a6581 @joeferner committed Feb 24, 2012
Showing with 9 additions and 9 deletions.
  1. +5 −5 README.md
  2. +1 −1 lib/nodeJavaBridge.js
  3. +3 −3 test/{requireClass-test.js → importClass-test.js}
View
@@ -41,15 +41,15 @@ java.newInstance("java.util.ArrayList", function(err, list) {
list.addSync("item2");
});
-var ArrayList = java.require('java.util.ArrayList');
+var ArrayList = java.import('java.util.ArrayList');
var list = new ArrayList();
list.addSync('item1');
```
# Index
## java
- * [require](#javaRequire)
+ * [import](#javaImport)
* [newInstance](#javaNewInstance)
* [callStaticMethod](#javaCallStaticMethod)
* [getStaticFieldValue](#javaGetStaticFieldValue)
@@ -66,8 +66,8 @@ list.addSync('item1');
<a name="java"/>
## java
-<a name="javaRequire" />
-**java.require(className)**
+<a name="javaImport" />
+**java.import(className)**
Loads the class given by className such that it acts and feels like a javascript object.
@@ -77,7 +77,7 @@ __Arguments__
__Example__
- var Test = java.require('Test');
+ var Test = java.import('Test');
Test.someStaticMethodSync(5);
console.log(Test.someStaticField);
View
@@ -8,7 +8,7 @@ java.classpath.push(__dirname + "/../commons-lang3-node-java.jar");
var MODIFIER_PUBLIC = 1;
var MODIFIER_STATIC = 8;
-java.require = function (name) {
+java.import = function (name) {
var clazz = java.findClassSync(name); // TODO: change to Class.forName when classloader issue is resolved.
var result = function () {
var args = [name];
@@ -4,14 +4,14 @@ var java = require("../testHelpers").java;
var nodeunit = require("nodeunit");
var util = require("util");
-exports['Require Class'] = nodeunit.testCase({
+exports['Import Class'] = nodeunit.testCase({
tearDown: function (callback) {
java.setStaticFieldValue("Test", "staticFieldInt", 42);
callback();
},
- "require": function (test) {
- var Test = java.require('Test');
+ "import": function (test) {
+ var Test = java.import('Test');
test.equals(42, Test.staticFieldInt);
Test.staticFieldInt = 200;
test.equals(200, Test.staticFieldInt);

0 comments on commit 9510862

Please sign in to comment.