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 classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classNested 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.NativeCallSingle-arity native callprotected static final String[]static final Class[][]protected Signatureprotected StaticScopeFields 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 voidcallTrace(ThreadContext context, boolean enabled, String name) protected final voidcallTraceCompiled(ThreadContext context, boolean enabled, String name, String file, int line) protected static voidcheckArgumentCount(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.booleanisNative()Returns true if this method is backed by native (i.e.booleanprotected static final voidpostBacktraceAndScope(ThreadContext context) protected static final voidpostBacktraceDummyScope(ThreadContext context) protected static final voidpostBacktraceOnly(ThreadContext context) protected static final voidpostFrameAndScope(ThreadContext context) protected static final voidpostFrameOnly(ThreadContext context) protected static final voidpostNoFrameDummyScope(ThreadContext context) protected static final voidpostNoop(ThreadContext context) protected static final voidpostScopeOnly(ThreadContext context) protected final voidpreBacktraceAndScope(ThreadContext context, String name) protected final voidpreBacktraceDummyScope(ThreadContext context, String name) protected final voidpreBacktraceOnly(ThreadContext context, String name) protected final voidpreFrameAndDummyScope(ThreadContext context, IRubyObject self, String name, Block block) Deprecated.protected final voidpreFrameAndDummyScope(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block) protected final voidpreFrameAndScope(ThreadContext context, IRubyObject self, String name, Block block) Deprecated.protected final voidpreFrameAndScope(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block) protected final voidpreFrameOnly(ThreadContext context, IRubyObject self, String name, Block block) Deprecated.protected final voidpreFrameOnly(ThreadContext context, IRubyObject self, RubyModule frameClass, String name, Block block) protected final voidpreNoFrameDummyScope(ThreadContext context) protected final voidpreNoop()protected final voidpreScopeOnly(ThreadContext context) protected static IRubyObjectraiseArgumentError(JavaMethod method, ThreadContext context, String name, int given, int min, int max) protected final voidreturnTrace(ThreadContext context, boolean enabled, String name) protected final voidreturnTraceCompiled(ThreadContext context, boolean enabled, String name) voidDeprecated.voidsetCallerRequirement(CallConfiguration callerRequirement) Deprecated.voidsetJavaName(String javaName) voidsetNativeCall(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik) Set the single-arity NativeCall for this method.voidsetNativeCall(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik, boolean java) Set the single-arity NativeCall for this method.voidsetParameterDesc(String parameterDesc) voidsetParameterList(String[] parameterList) voidsetSignature(Signature signature) voidsetSingleton(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:DynamicMethodDuplicate 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:
dupin 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:DynamicMethodRetrieve 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:
getArityin classDynamicMethod- Returns:
- The arity of the method, as reported to Ruby consumers.
-
getSignature
Description copied from class:DynamicMethodRetrieve the signature of this method.- Overrides:
getSignaturein classDynamicMethod- Returns:
- the signature
-
setJavaName
-
getJavaName
-
setSingleton
public void setSingleton(boolean isSingleton) -
isSingleton
public boolean isSingleton() -
isNative
public boolean isNative()Description copied from class:DynamicMethodReturns true if this method is backed by native (i.e. Java) code.- Overrides:
isNativein classDynamicMethod- Returns:
- true If backed by Java code or JVM bytecode; false otherwise
-
getStaticScope
-
setParameterDesc
-
setParameterList
-
getParameterList
- Specified by:
getParameterListin interfaceMethodArgs2
-
setNativeCall
public void setNativeCall(Class nativeTarget, String nativeName, Class nativeReturn, Class[] nativeSignature, boolean statik, boolean java) Description copied from interface:NativeCallMethodSet the single-arity NativeCall for this method. All signatures for the non-single-arity getNativeCall will also be set to this value.- Specified by:
setNativeCallin 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:NativeCallMethodSet the single-arity NativeCall for this method. All signatures for the non-single-arity getNativeCall will also be set to this value.- Specified by:
setNativeCallin interfaceNativeCallMethod- Parameters:
nativeTarget- native method targetnativeName- native method namenativeReturn- native method returnnativeSignature- native method argumentsstatik- static?- See Also:
-
getNativeCall
Description copied from interface:NativeCallMethodGet the NativeCall for the method, if available.- Specified by:
getNativeCallin 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.
-