日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java复制类mytool_MyTools

發布時間:2024/10/12 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java复制类mytool_MyTools 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

軟件簡介

該 jar 包對 java 調用 Groovy 、JavaScript、Clojure 腳本語言的接口進行封裝,方便在java程序中進行多語言混合編程

在jar中增加對URLClassLoader類進行繼承重寫實現動態加載和拆卸jar,使用Message類進行jar插件間的解耦調用。

包管理工具采用 Gradle 進行管理

使用示例:

@Test

public void testJava() throws Exception {

JavaHepler jh = new JavaHepler();

//jh.putPath("Test", "test.Test");

//IMethod d = jh.newInstance("Test");

//or

IMethod d = jh.newInstance("test.Test");

IInvoke i = d.getMethod("p");

i.invoke();

i = d.getMethod("p2");

i.invoke("MyTools");

}

//@Test

public void javaScript() {

long b = System.currentTimeMillis();

String[] s = new String[] { "test/test.js" };

JSHelper js = new JSHelper(s);

js.addField("ca").javaToJs(System.out);

System.out.println(js.getMethod("test").invoke());

js.exit();

long e = System.currentTimeMillis();

System.out.println("js :" + (e - b));

}

//@Test

public void groovy() throws Exception {

String file = "test/Test.groovy";

long b = System.currentTimeMillis();

GroovyHelper gh = new GroovyHelper();

//gh.putPath("Test", file);

//gh.newInstance("Test").getMethod("t").invoke();

//or

gh.newInstance(file).getMethod("t").invoke();

long e = System.currentTimeMillis();

System.out.println("Groovy :" + (e - b));

}

//@Test

public void clojure() throws Exception {

String file = "test/test_t.clj";

long b = System.currentTimeMillis();

ClojureHelper cl = new ClojureHelper();

//cl.putPath("test", file);

//IMethod c = cl.newInstance("test");

//or

IMethod c = cl.newInstance(file);

IInvoke i = c.getMethod("t3");

System.out.println(i.invoke(4));

long e = System.currentTimeMillis();

System.out.println("clojure :" + (e - b));

}

//@Test

public void jython() throws Exception {

String file = "test/Test.py";

long b = System.currentTimeMillis();

JythonHelper jy = new JythonHelper();

//jy.putPath("Test", file);

//jy.newInstance("Test").getMethod("t").invoke();

//or

jy.newInstance(file).getMethod("t").invoke();

long e = System.currentTimeMillis();

System.out.println("jython :" + (e - b));

}

//@Test

public void jruby() throws Exception {

String file = "test/Rr.rb";

long b = System.currentTimeMillis();

JRubyHelper jr = new JRubyHelper();

//jr.putPath("Rr", file);

//Object obj = jr.newInstance("Rr").getMethod("c2f").invoke(100);

//or

Object obj = jr.newInstance(file).getMethod("c2f").invoke(100);

System.out.println(obj);

long e = System.currentTimeMillis();

System.out.println("jruby :" + (e - b));

}

//@Test

public void beanShell() throws EvalError, IOException{

long b = System.currentTimeMillis();

BeanShellHelper bsh = new BeanShellHelper();

bsh.getFied("a").set("Hello World");

bsh.load("test/test.bsh");

System.out.println(bsh.getFied("b").get());

long e = System.currentTimeMillis();

System.out.println("jruby :" + (e - b));

}

增加對beanShell調用的支持

總結

以上是生活随笔為你收集整理的java复制类mytool_MyTools的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。