Module: HelloJavaLib
- Defined in:
- lib/hellojava.rb
Overview
jrubyからjavaの呼び出し
Defined Under Namespace
Classes: FuncTypes
Class Method Summary collapse
-
.func_a ⇒ void
Systemクラス使用.
-
.func_b ⇒ void
標準クラス以外の使用.
-
.func_c(value1, value2) ⇒ void
戻り値がオブジェクトの場合.
-
.func_h(vals) ⇒ void
引数にHashの場合.
-
.func_v(fname, vals) ⇒ void
引数に二次元配列の場合.
Class Method Details
.func_a ⇒ void
Systemクラス使用
17 18 19 |
# File 'lib/hellojava.rb', line 17 def func_a() System.out.println("Hello, JRuby") end |
.func_b ⇒ void
標準クラス以外の使用
26 27 28 29 |
# File 'lib/hellojava.rb', line 26 def func_b() p JavaCallTest.str1 return end |
.func_c(value1, value2) ⇒ void
戻り値がオブジェクトの場合
38 39 40 41 42 43 |
# File 'lib/hellojava.rb', line 38 def func_c(value1, value2) hoge = Hoge.new calc = hoge.getCalc(value1, value2) p calc.add return end |
.func_h(vals) ⇒ void
引数にHashの場合
83 84 85 86 87 88 89 |
# File 'lib/hellojava.rb', line 83 def func_h(vals) o = HashMap.new vals.each{|k, v| o[k] = v.to_java(Java::double) } JavaCallTest.hash(o) end |
.func_v(fname, vals) ⇒ void
引数に二次元配列の場合
62 63 64 65 66 67 |
# File 'lib/hellojava.rb', line 62 def func_v(fname, vals) JavaCallTest.sub1( fname, vals.to_java(Java::double[]) ); return end |