Class JavaMethod

java.lang.Object
org.jruby.internal.runtime.methods.DynamicMethod
org.jruby.internal.runtime.methods.JavaMethod
All Implemented Interfaces:
Cloneable, MethodArgs2, NativeCallMethod
Direct Known Subclasses:
ConcreteJavaProxy.InitializeMethod, ConcreteJavaProxy.NewMethod, Java.JavaAccessor, Java.ProcToInterface.ConcreteMethod, JavaInterfaceTemplate.BlockInterfaceImpl, JavaInterfaceTemplate.BlockInterfaceImpl.ConcreteMethod, JavaInterfaceTemplate.DummyMethodImpl, JavaMethod.JavaMethodNBlock, MethodGatherer.NoConstructorMethod, RubyToJavaInvoker

public abstract class JavaMethod extends DynamicMethod implements Cloneable, MethodArgs2, NativeCallMethod
  • Field Details

    • signature

      protected Signature signature
    • javaName

      private String javaName
    • isSingleton

      private boolean isSingleton
    • staticScope

      protected StaticScope staticScope
    • parameterDesc

      private String parameterDesc
    • parameterList

      private String[] parameterList
    • nativeCall

      protected DynamicMethod.NativeCall nativeCall
      Single-arity native call
    • ONE_REQ

      private static final String[] ONE_REQ
    • TWO_REQ

      private static final String[] TWO_REQ
    • THREE_REQ

      private static final String[] THREE_REQ
    • REST

      protected static final String[] REST
    • METHODS

      public static final Class[][] METHODS
    • REST_METHODS

      public static final Class[][] REST_METHODS
    • BLOCK_METHODS

      public static final Class[][] BLOCK_METHODS
    • BLOCK_REST_METHODS

      public static final Class[][] BLOCK_REST_METHODS
    • NAME_PASSER

      @Deprecated public static final ThreadLocal<String> NAME_PASSER
      Deprecated.
      Used for old-style nameless constructor to pass name in out-of-band.
  • Constructor Details

  • Method Details

    • dup

      public DynamicMethod dup()
      Description copied from class: DynamicMethod
      Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes. It is not required that this method produce a new object if the semantics of the DynamicMethod subtype do not require such.
      Specified by:
      dup in class DynamicMethod
      Returns:
      An identical DynamicMethod object to the target.
    • preFrameAndScope

      protected final void preFrameAndScope(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block)
    • preFrameAndDummyScope

      protected final void preFrameAndDummyScope(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block)
    • preFrameOnly

      protected final void preFrameOnly(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block)
    • preFrameAndScope

      @Deprecated protected final void preFrameAndScope(ThreadContext context, IRubyObject self, String name, Block block)
      Deprecated.
    • preFrameAndDummyScope

      @Deprecated protected final void preFrameAndDummyScope(ThreadContext context, IRubyObject self, String name, Block block)
      Deprecated.
    • preFrameOnly

      @Deprecated protected final void preFrameOnly(ThreadContext context, IRubyObject self, String name, Block block)
      Deprecated.
    • preScopeOnly

      protected final void preScopeOnly(ThreadContext context)
    • preNoFrameDummyScope

      protected final void preNoFrameDummyScope(ThreadContext context)
    • preBacktraceOnly

      protected final void preBacktraceOnly(ThreadContext context, String name)
    • preBacktraceDummyScope

      protected final void preBacktraceDummyScope(ThreadContext context, String name)
    • preBacktraceAndScope

      protected final void preBacktraceAndScope(ThreadContext context, String name)
    • preNoop

      protected final void preNoop()
    • postFrameAndScope

      protected static final void postFrameAndScope(ThreadContext context)
    • postFrameOnly

      protected static final void postFrameOnly(ThreadContext context)
    • postScopeOnly

      protected static final void postScopeOnly(ThreadContext context)
    • postNoFrameDummyScope

      protected static final void postNoFrameDummyScope(ThreadContext context)
    • postBacktraceOnly

      protected static final void postBacktraceOnly(ThreadContext context)
    • postBacktraceDummyScope

      protected static final void postBacktraceDummyScope(ThreadContext context)
    • postBacktraceAndScope

      protected static final void postBacktraceAndScope(ThreadContext context)
    • postNoop

      protected static final void postNoop(ThreadContext context)
    • callTrace

      protected final void callTrace(ThreadContext context, boolean enabled, String name)
    • returnTrace

      protected final void returnTrace(ThreadContext context, boolean enabled, String name)
    • callTraceCompiled

      protected final void callTraceCompiled(ThreadContext context, boolean enabled, String name, String file, int line)
    • returnTraceCompiled

      protected final void returnTraceCompiled(ThreadContext context, boolean enabled, String name)
    • setArity

      @Deprecated public void setArity(Arity arity)
      Deprecated.
    • setSignature

      public void setSignature(Signature signature)
    • getArity

      @Deprecated public Arity getArity()
      Deprecated.
      Description copied from class: DynamicMethod
      Retrieve the arity of this method, used for reporting arity to Ruby code. This arity may or may not reflect the actual specific or variable arities of the referenced method.
      Overrides:
      getArity in class DynamicMethod
      Returns:
      The arity of the method, as reported to Ruby consumers.
    • getSignature

      public Signature getSignature()
      Description copied from class: DynamicMethod
      Retrieve the signature of this method.
      Overrides:
      getSignature in class DynamicMethod
      Returns:
      the signature
    • setJavaName

      public void setJavaName(String javaName)
    • getJavaName

      public String getJavaName()
    • setSingleton

      public void setSingleton(boolean isSingleton)
    • isSingleton

      public boolean isSingleton()
    • isNative

      public boolean isNative()
      Description copied from class: DynamicMethod
      Returns true if this method is backed by native (i.e. Java) code.
      Overrides:
      isNative in class DynamicMethod
      Returns:
      true If backed by Java code or JVM bytecode; false otherwise
    • getStaticScope

      public StaticScope getStaticScope()
    • setParameterDesc

      public void setParameterDesc(String parameterDesc)
    • setParameterList

      public void setParameterList(String[] parameterList)
    • getParameterList

      public String[] getParameterList()
      Specified by:
      getParameterList in interface MethodArgs2
    • setNativeCall

      public void setNativeCall(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik, boolean java)
      Description copied from interface: NativeCallMethod
      Set the single-arity NativeCall for this method. All signatures for the non-single-arity getNativeCall will also be set to this value.
      Specified by:
      setNativeCall in interface NativeCallMethod
      Parameters:
      nativeTarget - native method target
      nativeName - native method name
      nativeReturn - native method return
      nativeSignature - native method arguments
      statik - static?
      java - plain Java method?
      See Also:
    • setNativeCall

      public void setNativeCall(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik)
      Description copied from interface: NativeCallMethod
      Set the single-arity NativeCall for this method. All signatures for the non-single-arity getNativeCall will also be set to this value.
      Specified by:
      setNativeCall in interface NativeCallMethod
      Parameters:
      nativeTarget - native method target
      nativeName - native method name
      nativeReturn - native method return
      nativeSignature - native method arguments
      statik - static?
      See Also:
    • getNativeCall

      public DynamicMethod.NativeCall getNativeCall()
      Description copied from interface: NativeCallMethod
      Get the NativeCall for the method, if available.
      Specified by:
      getNativeCall in interface NativeCallMethod
      Returns:
      a NativeCall if the method has a native representation.
      See Also:
    • raiseArgumentError

      protected static IRubyObject raiseArgumentError(JavaMethod method, ThreadContext context, String name, int given, int min, int max)
    • checkArgumentCount

      protected static void checkArgumentCount(JavaMethod method, ThreadContext context, String name, IRubyObject[] args, int num)
    • getCallerRequirement

      @Deprecated public CallConfiguration getCallerRequirement()
      Deprecated.
    • setCallerRequirement

      @Deprecated public void setCallerRequirement(CallConfiguration callerRequirement)
      Deprecated.