Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Double Dee
RE: How to explicitily cast using Rjb? [ reply ]  
2009-09-28 17:00
My bad, the error thrown was from somewhere else.

By: Double Dee
RE: How to explicitily cast using Rjb? [ reply ]  
2009-09-28 16:37
I'm upping this thread because I just discovered rjb and ran into the same problem.

My java code needs to do the following:

ClassA variable = (ClassA) new ClassB()

How would that get translated in Ruby code that uses rjb?

By: arton Tajima
RE: How to explicitily cast using Rjb? [ reply ]  
2008-10-18 01:21
I suppose _invoke is for you.
Rjb#_invoke is a method that a caller can specify methods exactly with method signatures (argumet's class).
for example there is a method as:
void foo(byte x);
you can call the method as 'bar.foo((byte)3)' in Java.
Also you can call the method as 'bar._invoke("foo", "B", 3)' in Ruby.

Hope it's helpful.

By: Jim Benton
How to explicitily cast using Rjb? [ reply ]  
2008-10-17 20:54
I'm working with some Java libraries that require one to use the Java cast operator to cast an object to another type. I've been looking through the Rjb source, and I can't seem to find a way to do this.

I suppose I could write a Java lib that could handle just that, but Rjb is doing everything else I need so nicely! Is there something here I'm missing?