Class RubyToJavaInvoker<T extends JavaCallable>

All Implemented Interfaces:
Cloneable, MethodArgs2, NativeCallMethod
Direct Known Subclasses:
ConstructorInvoker, MethodInvoker

public abstract class RubyToJavaInvoker<T extends JavaCallable> extends JavaMethod
  • Field Details

  • Constructor Details

  • Method Details

    • initialize

      void initialize()
    • setSignature

      private void setSignature(int minArity, int maxArity, int minVarArgsArity)
    • setupNativeCall

      final void setupNativeCall()
    • setNativeCallIfPublic

      private boolean setNativeCallIfPublic(Method method)
    • getSignature

      public final T getSignature(int signatureCode)
      Internal API
      Parameters:
      signatureCode -
      Returns:
      callable
    • putSignature

      public final void putSignature(int signatureCode, T callable)
      Internal API
      Parameters:
      signatureCode -
      callable -
    • createCallable

      protected abstract T createCallable(Ruby runtime, Member member)
    • createCallableArray

      protected abstract T[] createCallableArray(T callable)
    • createCallableArray

      protected abstract T[] createCallableArray(int size)
    • createCallableArrayArray

      protected abstract T[][] createCallableArrayArray(int size)
    • getMemberParameterTypes

      protected abstract Class[] getMemberParameterTypes(Member member)
    • isMemberVarArgs

      @Deprecated protected abstract boolean isMemberVarArgs(Member member)
      Deprecated.
    • getMemberArity

      final int getMemberArity(Member member)
    • convertArguments

      public static Object[] convertArguments(ParameterTypes method, IRubyObject[] args)
    • convertArguments

      public static Object[] convertArguments(ParameterTypes method, IRubyObject[] args, int addSpace)
    • convertArguments

      public static Object[] convertArguments(ParameterTypes method, IRubyObject arg0, int addSpace)
    • convertVarArgumentsOnly

      private static <T> Object convertVarArgumentsOnly(Class<T> varArrayType, int varStart, IRubyObject[] args)
    • convertVarArgumentsOnly

      private static Object convertVarArgumentsOnly(Class<?> varArrayType, IRubyObject arg0)
    • castJavaProxy

      static JavaProxy castJavaProxy(IRubyObject self)
    • unwrapIfJavaProxy

      static Object unwrapIfJavaProxy(IRubyObject object)
    • setAccessible

      static <T extends AccessibleObject & Member> T setAccessible(T accessible)
    • setAccessible

      static <T extends AccessibleObject & Member> T[] setAccessible(T[] accessibles)
    • rethrowIfNotInaccessibleObject

      private static void rethrowIfNotInaccessibleObject(RuntimeException re)
    • findCallable

      public T findCallable(IRubyObject self, String name, IRubyObject[] args, int arity)
      Find the matching callable object given the target proxy wrapper, method name, arguments, and actual arity.
      Parameters:
      self - the proxy wrapper
      name - the method name
      args - the arguments
      arity - the actual arity
      Returns:
      a suitable callable, or else raises an argument or name error
    • findCallableArityZero

      protected final T findCallableArityZero(IRubyObject self, String name)
    • findCallableArityOne

      protected final T findCallableArityOne(IRubyObject self, String name, IRubyObject arg0)
    • findCallableArityTwo

      protected final T findCallableArityTwo(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1)
    • findCallableArityThree

      protected final T findCallableArityThree(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
    • findCallableArityFour

      protected final T findCallableArityFour(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
    • findCallableArityN

      private T findCallableArityN(IRubyObject self, String name, IRubyObject[] args, int arity)
    • matchVarArgsCallableArityZero

      private T matchVarArgsCallableArityZero(IRubyObject self)
    • matchVarArgsCallableArityOne

      private T matchVarArgsCallableArityOne(IRubyObject self, IRubyObject arg0)
    • matchVarArgsCallableArityTwo

      private T matchVarArgsCallableArityTwo(IRubyObject self, IRubyObject arg0, IRubyObject arg1)
    • matchVarArgsCallableArityThree

      private T matchVarArgsCallableArityThree(IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
    • matchVarArgsCallableArityFour

      private T matchVarArgsCallableArityFour(IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
    • matchVarArgsCallableArityN

      private T matchVarArgsCallableArityN(IRubyObject self, IRubyObject[] args)
    • checkCallableArity

      private void checkCallableArity(T callable, int expected)
    • someCallable

      private T someCallable()
    • isConstructor

      private boolean isConstructor()
    • newErrorDueArgumentTypeMismatch

      RaiseException newErrorDueArgumentTypeMismatch(IRubyObject receiver, T[] methods, IRubyObject... args)
    • newErrorDueNoMatchingCallable

      private RaiseException newErrorDueNoMatchingCallable(IRubyObject receiver, String name)
    • getClass

      private static Class<?> getClass(IRubyObject object)
    • formatReceiver

      private static String formatReceiver(IRubyObject object)