JavaCall.jl
JavaCall.jl copied to clipboard
Add prototype jcall macro
Prototype @jcall macro:
julia> using JavaCall; JavaCall.init()
julia> System = @jimport java.lang.System
JavaObject{Symbol("java.lang.System")}
julia> @jcall System.out.println("Hello from Java!!"::JString)::Nothing
┌ Info: args:
│ func = :((:println, System.out))
│ rettype = :Nothing
│ types =
│ 1-element Vector{Any}:
│ :JString
│ args =
│ 1-element Vector{Any}:
│ "Hello from Java!!"
│ nreq = 0
│ func.head = :tuple
│ func.args =
│ 2-element Vector{Any}:
│ :(:println)
└ :(System.out)
Hello from Java!!
julia> Math = @jimport java.lang.Math
JavaObject{Symbol("java.lang.Math")}
julia> @jcall Math.cos(0.0::jdouble)::jdouble
┌ Info: args:
│ func = :((:cos, Math))
│ rettype = :jdouble
│ types =
│ 1-element Vector{Any}:
│ :jdouble
│ args =
│ 1-element Vector{Any}:
│ 0.0
│ nreq = 0
│ func.head = :tuple
│ func.args =
│ 2-element Vector{Any}:
│ :(:cos)
└ :Math
1.0
julia> @jcall Math.acos((-0.0)::jdouble)::jdouble
┌ Info: args:
│ func = :((:acos, Math))
│ rettype = :jdouble
│ types =
│ 1-element Vector{Any}:
│ :jdouble
│ args =
│ 1-element Vector{Any}:
│ -0.0
│ nreq = 0
│ func.head = :tuple
│ func.args =
│ 2-element Vector{Any}:
│ :(:acos)
└ :Math
1.5707963267948966