public IRubyObject convert(Ruby runtime, Object object) { IRubyObject result = trySimpleConversions(runtime, object); if (result != null) return result; return JavaObject.wrap(runtime, object); } public IRubyObject get(Ruby runtime, Object array, int i) {
public IRubyObject convert(Ruby runtime, Object object) { IRubyObject result = trySimpleConversions(runtime, object); if (result != null) return result; return JavaObject.wrap(runtime, object); } public IRubyObject get(Ruby runtime, Object array, int i) {
public IRubyObject convert(Ruby runtime, Object object) { IRubyObject result = trySimpleConversions(runtime, object); return result == null ? JavaObject.wrap(runtime, object) : result; } public IRubyObject get(Ruby runtime, Object array, int i) {
private void lazyJavaObject() { if (javaObject == null) { javaObject = JavaObject.wrap(getRuntime(), object); } }
public IRubyObject convert(Ruby runtime, Object object) { IRubyObject result = trySimpleConversions(runtime, object); return result == null ? JavaObject.wrap(runtime, object) : result; } public IRubyObject get(Ruby runtime, Object array, int i) {
private void lazyJavaObject() { if (javaObject == null) { javaObject = JavaObject.wrap(getRuntime(), object); } }
@JRubyMethod(meta = true) public static IRubyObject wrap(final ThreadContext context, final IRubyObject self, final IRubyObject object) { final Object objectValue = unwrapObject(object, NEVER); if ( objectValue == NEVER ) return context.nil; return wrap(context.runtime, objectValue); }
@JRubyMethod(meta = true) public static IRubyObject wrap(final ThreadContext context, final IRubyObject self, final IRubyObject object) { final Object objectValue = unwrapObject(object, NEVER); if ( objectValue == NEVER ) return context.nil; return wrap(context.runtime, objectValue); }
@JRubyMethod(meta = true) public static IRubyObject wrap(ThreadContext context, IRubyObject self, IRubyObject object) { Ruby runtime = context.runtime; Object obj = getWrappedObject(object, NEVER); if (obj == NEVER) return runtime.getNil(); return wrap(runtime, obj); }
@JRubyMethod(meta = true) public static IRubyObject wrap(ThreadContext context, IRubyObject self, IRubyObject object) { Ruby runtime = context.runtime; Object obj = getWrappedObject(object, NEVER); if (obj == NEVER) return runtime.getNil(); return wrap(runtime, obj); }
public JavaObject newInstance(final IRubyObject self, Object[] args) throws RaiseException { final Ruby runtime = getRuntime(); JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstance(args, handler)); } catch (Throwable ex) { throw mapInstantiationException(runtime, ex); } }
public JavaObject newInstance(final IRubyObject self, Object[] args) throws RaiseException { final Ruby runtime = getRuntime(); JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstance(args, handler)); } catch (Throwable ex) { throw mapInstantiationException(runtime, ex); } }
public final JavaObject newInstance(final IRubyObject self, IRubyObject[] args) throws RaiseException { final Ruby runtime = getRuntime(); final Object[] javaArgsPlus1 = RubyToJavaInvoker.convertArguments(this, args, +1); JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstanceImpl(javaArgsPlus1, handler)); } catch (Throwable ex) { throw mapInstantiationException(runtime, ex); } }
public Object invoke(Object proxy, JavaProxyMethod method, Object[] nargs) throws Throwable { final int length = nargs == null ? 0 : nargs.length; final IRubyObject[] rubyArgs = new IRubyObject[length + 2]; rubyArgs[0] = JavaObject.wrap(runtime, proxy); rubyArgs[1] = method; for ( int i = 0; i < length; i++ ) { rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(runtime, nargs[i]); } IRubyObject procResult = proc.call(runtime.getCurrentContext(), rubyArgs); return procResult.toJava( method.getReturnType() ); }
public final JavaObject newInstance(final IRubyObject self, IRubyObject arg0) throws RaiseException { final Ruby runtime = getRuntime(); final Object[] javaArgsPlus1 = RubyToJavaInvoker.convertArguments(this, arg0, +1); JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstanceImpl(javaArgsPlus1, handler)); } catch (Throwable ex) { throw mapInstantiationException(runtime, ex); } }
public final JavaObject newInstance(final IRubyObject self, IRubyObject[] args) throws RaiseException { final Ruby runtime = getRuntime(); final Object[] javaArgsPlus1 = RubyToJavaInvoker.convertArguments(this, args, +1); JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstanceImpl(javaArgsPlus1, handler)); } catch (Throwable ex) { throw mapInstantiationException(runtime, ex); } }
public final JavaObject newInstance(final IRubyObject self, IRubyObject arg0) throws RaiseException { final Ruby runtime = getRuntime(); final Object[] javaArgsPlus1 = RubyToJavaInvoker.convertArguments(this, arg0, +1); JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstanceImpl(javaArgsPlus1, handler)); } catch (Throwable ex) { throw mapInstantiationException(runtime, ex); } }
public Object invoke(Object proxy, JavaProxyMethod method, Object[] nargs) throws Throwable { final int length = nargs == null ? 0 : nargs.length; final IRubyObject[] rubyArgs = new IRubyObject[length + 2]; rubyArgs[0] = JavaObject.wrap(runtime, proxy); rubyArgs[1] = method; for ( int i = 0; i < length; i++ ) { rubyArgs[i + 2] = JavaUtil.convertJavaToRuby(runtime, nargs[i]); } IRubyObject procResult = proc.call(runtime.getCurrentContext(), rubyArgs); return procResult.toJava( method.getReturnType() ); }
@JRubyMethod(rest = true) public RubyObject new_instance2(IRubyObject[] args, Block unusedBlock) { final Ruby runtime = getRuntime(); Arity.checkArgumentCount(runtime, args, 2, 2); final IRubyObject self = args[0]; final Object[] convertedArgs = convertArguments((RubyArray) args[1]); // constructor arguments JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstance(convertedArgs, handler)); } catch (Exception ex) { throw mapInstantiationException(runtime, ex); } }
@JRubyMethod(rest = true) public RubyObject new_instance2(IRubyObject[] args, Block unusedBlock) { final Ruby runtime = getRuntime(); Arity.checkArgumentCount(runtime, args, 2, 2); final IRubyObject self = args[0]; final Object[] convertedArgs = convertArguments((RubyArray) args[1]); // constructor arguments JavaProxyInvocationHandler handler = new MethodInvocationHandler(runtime, self); try { return JavaObject.wrap(runtime, newInstance(convertedArgs, handler)); } catch (Exception ex) { throw mapInstantiationException(runtime, ex); } }