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:
JavaMethod.JavaMethodNBlock
,RubyToJavaInvoker
public abstract class JavaMethod
extends DynamicMethod
implements Cloneable, MethodArgs2, NativeCallMethod
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
Nested classes/interfaces inherited from class org.jruby.internal.runtime.methods.DynamicMethod
DynamicMethod.NativeCall, DynamicMethod.Version
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Class[][]
static final Class[][]
static final Class[][]
static final ThreadLocal
<String> Deprecated.protected DynamicMethod.NativeCall
Single-arity native callprotected static final String[]
static final Class[][]
protected Signature
protected StaticScope
Fields inherited from class org.jruby.internal.runtime.methods.DynamicMethod
aliasCount, definedClass, flags, handle, implementationClass, name, protectedClass, serialNumber
-
Constructor Summary
ConstructorsConstructorDescriptionJavaMethod
(RubyModule implementationClass, Visibility visibility) Deprecated.JavaMethod
(RubyModule implementationClass, Visibility visibility, String name) JavaMethod
(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig) Deprecated.JavaMethod
(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig, String name) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
callTrace
(ThreadContext context, boolean enabled, String name) protected final void
callTraceCompiled
(ThreadContext context, boolean enabled, String name, String file, int line) protected static void
checkArgumentCount
(JavaMethod method, ThreadContext context, String name, IRubyObject[] args, int num) dup()
Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes.getArity()
Deprecated.Deprecated.Get the NativeCall for the method, if available.String[]
Retrieve the signature of this method.boolean
isNative()
Returns true if this method is backed by native (i.e.boolean
protected static final void
postBacktraceAndScope
(ThreadContext context) protected static final void
postBacktraceDummyScope
(ThreadContext context) protected static final void
postBacktraceOnly
(ThreadContext context) protected static final void
postFrameAndScope
(ThreadContext context) protected static final void
postFrameOnly
(ThreadContext context) protected static final void
postNoFrameDummyScope
(ThreadContext context) protected static final void
postNoop
(ThreadContext context) protected static final void
postScopeOnly
(ThreadContext context) protected final void
preBacktraceAndScope
(ThreadContext context, String name) protected final void
preBacktraceDummyScope
(ThreadContext context, String name) protected final void
preBacktraceOnly
(ThreadContext context, String name) protected final void
preFrameAndDummyScope
(ThreadContext context, IRubyObject self, String name, Block block) Deprecated.protected final void
preFrameAndDummyScope
(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block) protected final void
preFrameAndScope
(ThreadContext context, IRubyObject self, String name, Block block) Deprecated.protected final void
preFrameAndScope
(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block) protected final void
preFrameOnly
(ThreadContext context, IRubyObject self, String name, Block block) Deprecated.protected final void
preFrameOnly
(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block) protected final void
preNoFrameDummyScope
(ThreadContext context) protected final void
preNoop()
protected final void
preScopeOnly
(ThreadContext context) protected static IRubyObject
raiseArgumentError
(JavaMethod method, ThreadContext context, String name, int given, int min, int max) protected final void
returnTrace
(ThreadContext context, boolean enabled, String name) protected final void
returnTraceCompiled
(ThreadContext context, boolean enabled, String name) void
Deprecated.void
setCallerRequirement
(CallConfiguration callerRequirement) Deprecated.void
setJavaName
(String javaName) void
setNativeCall
(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik) Set the single-arity NativeCall for this method.void
setNativeCall
(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik, boolean java) Set the single-arity NativeCall for this method.void
setParameterDesc
(String parameterDesc) void
setParameterList
(String[] parameterList) void
setSignature
(Signature signature) void
setSingleton
(boolean isSingleton) Methods inherited from class org.jruby.internal.runtime.methods.DynamicMethod
adjustAliasCount, calculateProtectedClass, call, call, call, call, call, call, call, call, call, call, callRespondTo, getAliasCount, getCallConfig, getDefinedClass, getHandle, getImplementationClass, getInstanceVariableNames, getMethodData, getName, getProtectedClass, getRealMethod, getSerialNumber, getVisibility, init, init, isBuiltin, isCallableFrom, isImplementedBy, isNotImplemented, isNull, isRefined, isUndefined, setCallConfig, setDefinedClass, setHandle, setImplementationClass, setIsBuiltin, setNotImplemented, setRuby2Keywords, setVisibility
-
Field Details
-
signature
-
staticScope
-
nativeCall
Single-arity native call -
REST
-
METHODS
-
REST_METHODS
-
BLOCK_METHODS
-
BLOCK_REST_METHODS
-
NAME_PASSER
Deprecated.Used for old-style nameless constructor to pass name in out-of-band.
-
-
Constructor Details
-
JavaMethod
-
JavaMethod
@Deprecated public JavaMethod(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig) Deprecated. -
JavaMethod
@Deprecated public JavaMethod(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig, String name) Deprecated. -
JavaMethod
Deprecated.
-
-
Method Details
-
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 classDynamicMethod
- 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
-
preNoFrameDummyScope
-
preBacktraceOnly
-
preBacktraceDummyScope
-
preBacktraceAndScope
-
preNoop
protected final void preNoop() -
postFrameAndScope
-
postFrameOnly
-
postScopeOnly
-
postNoFrameDummyScope
-
postBacktraceOnly
-
postBacktraceDummyScope
-
postBacktraceAndScope
-
postNoop
-
callTrace
-
returnTrace
-
callTraceCompiled
protected final void callTraceCompiled(ThreadContext context, boolean enabled, String name, String file, int line) -
returnTraceCompiled
-
setArity
Deprecated. -
setSignature
-
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 classDynamicMethod
- Returns:
- The arity of the method, as reported to Ruby consumers.
-
getSignature
Description copied from class:DynamicMethod
Retrieve the signature of this method.- Overrides:
getSignature
in classDynamicMethod
- Returns:
- the signature
-
setJavaName
-
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 classDynamicMethod
- Returns:
- true If backed by Java code or JVM bytecode; false otherwise
-
getStaticScope
-
setParameterDesc
-
setParameterList
-
getParameterList
- Specified by:
getParameterList
in interfaceMethodArgs2
-
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 interfaceNativeCallMethod
- Parameters:
nativeTarget
- native method targetnativeName
- native method namenativeReturn
- native method returnnativeSignature
- native method argumentsstatik
- 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 interfaceNativeCallMethod
- Parameters:
nativeTarget
- native method targetnativeName
- native method namenativeReturn
- native method returnnativeSignature
- native method argumentsstatik
- static?- See Also:
-
getNativeCall
Description copied from interface:NativeCallMethod
Get the NativeCall for the method, if available.- Specified by:
getNativeCall
in interfaceNativeCallMethod
- 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. -
setCallerRequirement
Deprecated.
-