Referring to a Java Class type from Ruby

I’m working on a game in libgdx, a Java library, and one of the methods
requires a reference to the type of Java class being passed.

In Java, the method is:

public T get (String name, Class type) {

}

And the call was:

craftWindow.setStyle(skin.get(“craftWindow”, WindowStyle.class));

How can I do this call in JRuby? When I pass the same string and then
WindowStyle.class it says:

no get with arguments matching [class org.jruby.
RubyString, class org.jruby.RubyClass] on object
#<Java::ComBadlogicGdxScenesSce
ne2dUi::Skin:0x1ce910e>

I’ve imported it with:

java_import com.badlogic.gdx.scenes.scene2d.ui.Window::WindowStyle

I’m not sure about that line either. Thanks for any help.

Try:

craftWindow.setStyle(skin.get(“craftWindow”.to_java,
WindowStyle.to_java.class));

Im not sure what the library is looking for here, but this may do the
trick

Thanks, that seems to do the trick. I didn’t even need it on the string,
just the WindowStyle class. Thanks again.