@JRubyMethod public static IRubyObject to_java(ThreadContext context, final IRubyObject fromObject, final IRubyObject type) { if ( type.isNil() ) return to_java(context, fromObject); final JavaClass targetType = resolveTargetType(context, type); if ( fromObject instanceof RubyArray ) { return targetType.javaArrayFromRubyArray(context, (RubyArray) fromObject); } return Java.getInstance(context.runtime, fromObject.toJava(targetType.javaClass())); }
@JRubyMethod public static IRubyObject to_java(ThreadContext context, final IRubyObject fromObject, final IRubyObject type) { if ( type.isNil() ) return to_java(context, fromObject); final JavaClass targetType = resolveTargetType(context, type); if ( fromObject instanceof RubyArray ) { return targetType.javaArrayFromRubyArray(context, (RubyArray) fromObject); } return Java.getInstance(context.runtime, fromObject.toJava(targetType.javaClass())); }
@JRubyMethod public static IRubyObject to_java(ThreadContext context, IRubyObject fromObject, IRubyObject type) { if (type.isNil()) { return to_java(context, fromObject); } Ruby runtime = context.runtime; JavaClass targetType = getTargetType(context, runtime, type); if (fromObject instanceof RubyArray) { return targetType.javaArrayFromRubyArray(context, fromObject); } else { return Java.getInstance(runtime, fromObject.toJava(targetType.javaClass())); } }
@JRubyMethod public static IRubyObject to_java(ThreadContext context, IRubyObject fromObject, IRubyObject type) { if (type.isNil()) { return to_java(context, fromObject); } Ruby runtime = context.runtime; JavaClass targetType = getTargetType(context, runtime, type); if (fromObject instanceof RubyArray) { return targetType.javaArrayFromRubyArray(context, fromObject); } else { return Java.getInstance(runtime, fromObject.toJava(targetType.javaClass())); } }