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 proxyMethod, Object[] nargs) throws Throwable { final RubyClass metaClass = self.getMetaClass(); final String name = proxyMethod.getName(); final DynamicMethod method = metaClass.searchMethod(name); final IRubyObject result = invokeRuby(method, proxyMethod, metaClass, name, nargs); final Class<?> returnType = proxyMethod.getReturnType(); return returnType == void.class ? null : result.toJava( returnType ); }
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 proxyMethod, Object[] nargs) throws Throwable { final RubyClass metaClass = self.getMetaClass(); final String name = proxyMethod.getName(); final DynamicMethod method = metaClass.searchMethod(name); final IRubyObject result = invokeRuby(method, proxyMethod, metaClass, name, nargs); final Class<?> returnType = proxyMethod.getReturnType(); return returnType == void.class ? null : result.toJava( returnType ); }
@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); } }
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 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); } }
@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); } }
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); } }