public abstract class DynamicMethod
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DynamicMethod.NativeCall |
static interface |
DynamicMethod.Version |
Modifier and Type | Field and Description |
---|---|
protected RubyModule |
definedClass
The module or class that originally defined this method.
|
protected byte |
flags
Flags for builtin, notimpl, etc
|
protected java.lang.Object |
handle
An arbitrarily-typed "method handle" for use by compilers and call sites
|
protected RubyModule |
implementationClass
The Ruby module or class from which this method should `super`.
|
protected java.lang.String |
name
The simple, base name this method was defined under.
|
protected RubyModule |
protectedClass
The "protected class" used for calculating protected access.
|
protected long |
serialNumber
The serial number for this method object, to globally identify it
|
Modifier | Constructor and Description |
---|---|
protected |
DynamicMethod(RubyModule implementationClass,
Visibility visibility)
Deprecated.
|
protected |
DynamicMethod(RubyModule implementationClass,
Visibility visibility,
CallConfiguration callConfig)
Deprecated.
|
protected |
DynamicMethod(RubyModule implementationClass,
Visibility visibility,
CallConfiguration callConfig,
java.lang.String name)
Deprecated.
|
protected |
DynamicMethod(RubyModule implementationClass,
Visibility visibility,
java.lang.String name)
Base constructor for dynamic method handles with names.
|
protected |
DynamicMethod(java.lang.String name)
A no-arg constructor used only by the UndefinedMethod subclass and
CompiledMethod handles.
|
Modifier and Type | Method and Description |
---|---|
protected static RubyModule |
calculateProtectedClass(RubyModule cls)
Calculate, based on given RubyModule, which class in its hierarchy
should be used to determine protected access.
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name)
Arity 0, no block
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
Block block)
Arity 0, with block; calls through IRubyObject[] path
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0)
Arity 1, no block
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule clazz,
java.lang.String name,
IRubyObject[] args)
A default implementation of n-arity, non-block 'call' method,
which simply calls the n-arity, block-receiving version with
the arg list and Block.NULL_BLOCK.
|
abstract IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule clazz,
java.lang.String name,
IRubyObject[] args,
Block block)
The minimum 'call' method required for a dynamic method handle.
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
Block block)
Arity 1, with block; calls through IRubyObject[] path
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1)
Arity 2, no block
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
Block block)
Arity 2, with block; calls through IRubyObject[] path
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2)
Arity 3, no block
|
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
Block block)
Arity 3, with block; calls through IRubyObject[] path
|
abstract DynamicMethod |
dup()
Duplicate this method, returning DynamicMethod referencing the same code
and with the same attributes.
|
Arity |
getArity()
Retrieve the arity of this method, used for reporting arity to Ruby
code.
|
CallConfiguration |
getCallConfig()
Deprecated.
|
RubyModule |
getDefinedClass()
Get the original owner of this method/
|
java.lang.Object |
getHandle()
Get the "handle" associated with this DynamicMethod.
|
RubyModule |
getImplementationClass()
Retrieve the class or module on which this method is implemented, used
for 'super' logic among others.
|
MethodData |
getMethodData()
Additional metadata about this method.
|
java.lang.String |
getName()
Get the base name this method was defined as.
|
protected RubyModule |
getProtectedClass()
Retrieve the pre-calculated "protected class" used for access checks.
|
DynamicMethod |
getRealMethod()
Get the "real" method contained within this method.
|
long |
getSerialNumber()
Get the global serial number for this method object
|
Visibility |
getVisibility()
Get the visibility of this method.
|
protected void |
init(RubyModule implementationClass,
Visibility visibility) |
protected void |
init(RubyModule implementationClass,
Visibility visibility,
CallConfiguration callConfig)
Deprecated.
|
boolean |
isBuiltin() |
boolean |
isCallableFrom(IRubyObject caller,
CallType callType)
Determine whether this method is callable from the given object using
the given call type.
|
boolean |
isImplementedBy(RubyModule other) |
boolean |
isNative()
Returns true if this method is backed by native (i.e.
|
boolean |
isNotImplemented()
Whether this method is "not implemented".
|
boolean |
isNull()
Whether this method is the "null" method, used to stop method
name resolution loops.
|
boolean |
isUndefined()
Whether this method is the "undefined" method, used to represent a
missing or undef'ed method.
|
void |
setCallConfig(CallConfiguration callConfig)
Deprecated.
|
void |
setDefinedClass(RubyModule definedClass)
Set the defining class for this method, as when restructuring hierarchy for prepend.
|
void |
setHandle(java.lang.Object handle)
Set the "handle" associated with this DynamicMethod.
|
void |
setImplementationClass(RubyModule implClass)
Set the class on which this method is implemented, used for 'super'
logic, among others.
|
void |
setIsBuiltin(boolean isBuiltin) |
void |
setNotImplemented(boolean setNotImplemented)
Set whether this method is "not implemented".
|
void |
setVisibility(Visibility visibility)
Set the visibility of this method.
|
protected RubyModule implementationClass
protected RubyModule protectedClass
protected RubyModule definedClass
protected long serialNumber
protected byte flags
protected final java.lang.String name
protected java.lang.Object handle
protected DynamicMethod(RubyModule implementationClass, Visibility visibility, java.lang.String name)
implementationClass
- The class to which this method will be
immediately boundvisibility
- The visibility assigned to this methodname
- The simple name of this methodprotected DynamicMethod(java.lang.String name)
@Deprecated protected DynamicMethod(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig)
@Deprecated protected DynamicMethod(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig, java.lang.String name)
@Deprecated protected DynamicMethod(RubyModule implementationClass, Visibility visibility)
DynamicMethod(RubyModule, Visibility, String)
protected void init(RubyModule implementationClass, Visibility visibility)
public long getSerialNumber()
public boolean isBuiltin()
public void setIsBuiltin(boolean isBuiltin)
public abstract IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, java.lang.String name, IRubyObject[] args, Block block)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callclazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodargs
- The argument list to this invocationblock
- The block passed to this invocationpublic IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, java.lang.String name, IRubyObject[] args)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callclazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodargs
- The first argument to this invocationpublic IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
public abstract DynamicMethod dup()
public boolean isCallableFrom(IRubyObject caller, CallType callType)
caller
- The calling objectcallType
- The type of callprotected static RubyModule calculateProtectedClass(RubyModule cls)
cls
- The class from which to calculateprotected RubyModule getProtectedClass()
public RubyModule getImplementationClass()
public boolean isImplementedBy(RubyModule other)
public void setImplementationClass(RubyModule implClass)
implClass
- The class on which this method is implementedpublic RubyModule getDefinedClass()
public void setDefinedClass(RubyModule definedClass)
public Visibility getVisibility()
public void setVisibility(Visibility visibility)
visibility
- The visibility of this methodpublic final boolean isUndefined()
public final boolean isNull()
public Arity getArity()
public DynamicMethod getRealMethod()
public boolean isNative()
public java.lang.String getName()
public java.lang.Object getHandle()
public void setHandle(java.lang.Object handle)
handle
- the handlepublic boolean isNotImplemented()
public MethodData getMethodData()
public void setNotImplemented(boolean setNotImplemented)
@Deprecated protected void init(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig)
@Deprecated public CallConfiguration getCallConfig()
@Deprecated public void setCallConfig(CallConfiguration callConfig)
Copyright © 2001-2018 JRuby. All Rights Reserved.