@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name) { if (javaVarargsCallables != null) return call(context, self, clazz, name, IRubyObject.NULL_ARRAY); JavaMethod method = (JavaMethod) findCallableArityZero(self, name); return method.invokeStaticDirect(context); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args) { JavaMethod method = (JavaMethod) findCallable(self, name, args, args.length); return method.invokeStaticDirect( context, convertArguments(method, args) ); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args) { JavaMethod method = (JavaMethod) findCallable(self, name, args, args.length); return method.invokeStaticDirect( context, convertArguments(method, args) ); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName) { String name = rubyName.asJavaString(); final Ruby runtime = context.runtime; JavaMethod method = new JavaMethod(runtime, getMethodFromClass(context, recv, name)); return method.invokeStaticDirect(context); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName) { String name = rubyName.asJavaString(); Ruby runtime = context.runtime; JavaMethod method = new JavaMethod(runtime, getMethodFromClass(runtime, recv, name)); return method.invokeStaticDirect(); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1) { if (javaVarargsCallables != null) return call(context, self, clazz, name, new IRubyObject[] {arg0, arg1}); JavaMethod method = (JavaMethod) findCallableArityTwo(self, name, arg0, arg1); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = arg0.toJava(paramTypes[0]); Object cArg1 = arg1.toJava(paramTypes[1]); return method.invokeStaticDirect(context, cArg0, cArg1); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName, IRubyObject argTypes) { String name = rubyName.asJavaString(); RubyArray argTypesAry = argTypes.convertToArray(); final Ruby runtime = context.runtime; checkArgSizeMismatch(runtime, 0, argTypesAry); JavaMethod method = new JavaMethod(runtime, getMethodFromClass(context, recv, name)); return method.invokeStaticDirect(context); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, Block block) { if (block.isGiven()) { RubyProc proc = RubyProc.newProc(context.runtime, block, block.type); JavaMethod method = (JavaMethod)findCallableArityOne(self, name, proc); Object cArg0 = convertArg(proc, method, 0); return method.invokeStaticDirect(cArg0); } else { return call(context, self, clazz, name); } }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName, IRubyObject argTypes) { String name = rubyName.asJavaString(); RubyArray argTypesAry = argTypes.convertToArray(); final Ruby runtime = context.runtime; checkArgSizeMismatch(runtime, 0, argTypesAry); JavaMethod method = new JavaMethod(runtime, getMethodFromClass(context, recv, name)); return method.invokeStaticDirect(context); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1) { if (javaVarargsCallables != null) return call(context, self, clazz, name, new IRubyObject[] {arg0, arg1}); JavaMethod method = (JavaMethod) findCallableArityTwo(self, name, arg0, arg1); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = arg0.toJava(paramTypes[0]); Object cArg1 = arg1.toJava(paramTypes[1]); return method.invokeStaticDirect(context, cArg0, cArg1); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, Block block) { if (block.isGiven()) { RubyProc proc = RubyProc.newProc(context.runtime, block, block.type); JavaMethod method = (JavaMethod)findCallableArityTwo(self, name, arg0, proc); Object cArg0 = convertArg(arg0, method, 0); Object cArg1 = convertArg(proc, method, 1); return method.invokeStaticDirect(cArg0, cArg1); } else { return call(context, self, clazz, name, arg0); } }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { if (javaVarargsCallables != null) return call(context, self, clazz, name, new IRubyObject[] {arg0, arg1, arg2}); JavaMethod method = (JavaMethod) findCallableArityThree(self, name, arg0, arg1, arg2); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = arg0.toJava(paramTypes[0]); Object cArg1 = arg1.toJava(paramTypes[1]); Object cArg2 = arg2.toJava(paramTypes[2]); return method.invokeStaticDirect(context, cArg0, cArg1, cArg2); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0) { if (javaVarargsCallables != null) return call(context, self, clazz, name, new IRubyObject[] {arg0}); JavaMethod method = (JavaMethod) findCallableArityOne(self, name, arg0); if (method.isVarArgs()) return call(context, self, clazz, name, new IRubyObject[] {arg0}); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = arg0.toJava(paramTypes[0]); return method.invokeStaticDirect(context, cArg0); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, Block block) { if (block.isGiven()) { RubyProc proc = RubyProc.newProc(context.runtime, block, block.type); JavaMethod method = (JavaMethod) findCallableArityOne(self, name, proc); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = proc.toJava(paramTypes[0]); return method.invokeStaticDirect(context, cArg0); } return call(context, self, clazz, name); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, Block block) { if (block.isGiven()) { RubyProc proc = RubyProc.newProc(context.runtime, block, block.type); JavaMethod method = (JavaMethod) findCallableArityTwo(self, name, arg0, proc); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = arg0.toJava(paramTypes[0]); Object cArg1 = proc.toJava(paramTypes[1]); return method.invokeStaticDirect(context, cArg0, cArg1); } return call(context, self, clazz, name, arg0); }
@Override public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, Block block) { if (block.isGiven()) { RubyProc proc = RubyProc.newProc(context.runtime, block, block.type); JavaMethod method = (JavaMethod) findCallableArityTwo(self, name, arg0, proc); final Class<?>[] paramTypes = method.getParameterTypes(); Object cArg0 = arg0.toJava(paramTypes[0]); Object cArg1 = proc.toJava(paramTypes[1]); return method.invokeStaticDirect(context, cArg0, cArg1); } return call(context, self, clazz, name, arg0); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName, IRubyObject argTypes, IRubyObject arg0) { String name = rubyName.asJavaString(); RubyArray argTypesAry = argTypes.convertToArray(); final Ruby runtime = context.runtime; checkArgSizeMismatch(runtime, 1, argTypesAry); Class argTypeClass = (Class) argTypesAry.eltInternal(0).toJava(Class.class); JavaMethod method = new JavaMethod(runtime, getMethodFromClass(context, recv, name, argTypeClass)); return method.invokeStaticDirect(context, arg0.toJava(argTypeClass)); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName, IRubyObject argTypes) { String name = rubyName.asJavaString(); RubyArray argTypesAry = argTypes.convertToArray(); Ruby runtime = context.runtime; if (argTypesAry.size() != 0) { Class[] argTypesClasses = (Class[]) argTypesAry.toArray(new Class[argTypesAry.size()]); throw JavaMethod.newArgSizeMismatchError(runtime, argTypesClasses); } JavaMethod method = new JavaMethod(runtime, getMethodFromClass(runtime, recv, name)); return method.invokeStaticDirect(); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName, IRubyObject argTypes) { String name = rubyName.asJavaString(); RubyArray argTypesAry = argTypes.convertToArray(); Ruby runtime = context.runtime; if (argTypesAry.size() != 0) { Class[] argTypesClasses = (Class[]) argTypesAry.toArray(new Class[argTypesAry.size()]); throw JavaMethod.newArgSizeMismatchError(runtime, argTypesClasses); } JavaMethod method = new JavaMethod(runtime, getMethodFromClass(runtime, recv, name)); return method.invokeStaticDirect(); }
@JRubyMethod(meta = true) public static IRubyObject java_send(ThreadContext context, IRubyObject recv, IRubyObject rubyName, IRubyObject argTypes, IRubyObject arg0) { String name = rubyName.asJavaString(); RubyArray argTypesAry = argTypes.convertToArray(); Ruby runtime = context.runtime; if (argTypesAry.size() != 1) { throw JavaMethod.newArgSizeMismatchError(runtime, (Class) argTypesAry.eltInternal(0).toJava(Class.class)); } Class argTypeClass = (Class) argTypesAry.eltInternal(0).toJava(Class.class); JavaMethod method = new JavaMethod(runtime, getMethodFromClass(runtime, recv, name, argTypeClass)); return method.invokeStaticDirect(arg0.toJava(argTypeClass)); }