Class DelegatingDynamicMethod
java.lang.Object
org.jruby.internal.runtime.methods.DynamicMethod
org.jruby.internal.runtime.methods.DelegatingDynamicMethod
- Direct Known Subclasses:
ProfilingDynamicMethod
,SynchronizedDynamicMethod
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.internal.runtime.methods.DynamicMethod
DynamicMethod.NativeCall, DynamicMethod.Version
-
Field Summary
FieldsFields inherited from class org.jruby.internal.runtime.methods.DynamicMethod
aliasCount, definedClass, flags, handle, implementationClass, name, protectedClass, serialNumber
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall
(ThreadContext context, IRubyObject self, RubyModule klazz, String name) call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, Block block) call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg) call
(ThreadContext context, IRubyObject self, RubyModule klazz, 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.call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject[] args, Block block) The minimum 'call' method required for a dynamic method handle.call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, Block block) call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2) call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, Block block) call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) call
(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) abstract DynamicMethod
dup()
Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes.boolean
getArity()
Deprecated.Get the "handle" associated with this DynamicMethod.Retrieve the class or module on which this method is implemented, used for 'super' logic among others.Additional metadata about this method.getName()
Get the base name this method was defined as.protected RubyModule
Retrieve the pre-calculated "protected class" used for access checks.Get the "real" method contained within this method.long
Get the global serial number for this method objectRetrieve the signature of this method.Get the visibility of this method.int
hashCode()
boolean
Whether this method is a builtin method, i.e.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
Whether this method is "not implemented".boolean
void
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) Force this method to be treated as a core built-in method if true, or as a normal non-core method otherwise.void
setNotImplemented
(boolean setNotImplemented) Set whether this method is "not implemented".void
setVisibility
(Visibility visibility) Set the visibility of this method.Methods inherited from class org.jruby.internal.runtime.methods.DynamicMethod
adjustAliasCount, calculateProtectedClass, callRespondTo, getAliasCount, getCallConfig, getDefinedClass, init, init, isNull, isUndefined, setCallConfig, setDefinedClass, setRuby2Keywords
-
Field Details
-
delegate
-
-
Constructor Details
-
DelegatingDynamicMethod
-
-
Method Details
-
getDelegate
-
call
- Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject[] args) Description copied from class:DynamicMethod
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.- Overrides:
call
in classDynamicMethod
- Parameters:
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodargs
- The first argument to this invocation- Returns:
- The result of the call
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, Block block) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, Block block) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, Block block) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) - Overrides:
call
in classDynamicMethod
-
call
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, String name, IRubyObject[] args, Block block) Description copied from class:DynamicMethod
The minimum 'call' method required for a dynamic method handle. Subclasses must implement this method, but may implement the other signatures to provide faster, non-boxing call paths. Typically subclasses will implement this method to check variable arity calls, then performing a specific-arity invocation to the appropriate method or performing variable-arity logic in-line.- Specified by:
call
in classDynamicMethod
- Parameters:
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- 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 invocation- Returns:
- The result of the call
-
setVisibility
Description copied from class:DynamicMethod
Set the visibility of this method.- Overrides:
setVisibility
in classDynamicMethod
- Parameters:
visibility
- The visibility of this method
-
setIsBuiltin
public void setIsBuiltin(boolean isBuiltin) Description copied from class:DynamicMethod
Force this method to be treated as a core built-in method if true, or as a normal non-core method otherwise.- Overrides:
setIsBuiltin
in classDynamicMethod
- Parameters:
isBuiltin
- true if this is a core built-in method, false otherwise
-
setImplementationClass
Description copied from class:DynamicMethod
Set the class on which this method is implemented, used for 'super' logic, among others.- Overrides:
setImplementationClass
in classDynamicMethod
- Parameters:
implClass
- The class on which this method is implemented
-
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
-
isCallableFrom
Description copied from class:DynamicMethod
Determine whether this method is callable from the given object using the given call type.- Overrides:
isCallableFrom
in classDynamicMethod
- Parameters:
caller
- The calling objectcallType
- The type of call- Returns:
- true if the call would not violate visibility; false otherwise
-
isBuiltin
public boolean isBuiltin()Description copied from class:DynamicMethod
Whether this method is a builtin method, i.e. a method built-in to JRuby and loaded during its core boot process.- Overrides:
isBuiltin
in classDynamicMethod
- Returns:
- true if this is a core built-in method, false otherwise
-
getVisibility
Description copied from class:DynamicMethod
Get the visibility of this method.- Overrides:
getVisibility
in classDynamicMethod
- Returns:
- The visibility of this method
-
getSerialNumber
public long getSerialNumber()Description copied from class:DynamicMethod
Get the global serial number for this method object- Overrides:
getSerialNumber
in classDynamicMethod
- Returns:
- This method object's serial number
-
getRealMethod
Description copied from class:DynamicMethod
Get the "real" method contained within this method. This simply returns self except in cases where a method is wrapped to give it a new name or new implementation class (AliasMethod, PartialDelegatingMethod, ...).- Overrides:
getRealMethod
in classDynamicMethod
- Returns:
- The "real" method associated with this one
-
getProtectedClass
Description copied from class:DynamicMethod
Retrieve the pre-calculated "protected class" used for access checks.- Overrides:
getProtectedClass
in classDynamicMethod
- Returns:
- The "protected class" for access checks.
-
getImplementationClass
Description copied from class:DynamicMethod
Retrieve the class or module on which this method is implemented, used for 'super' logic among others.- Overrides:
getImplementationClass
in classDynamicMethod
- Returns:
- The class on which this method is implemented
-
isImplementedBy
- Overrides:
isImplementedBy
in classDynamicMethod
-
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
-
getName
Description copied from class:DynamicMethod
Get the base name this method was defined as.- Overrides:
getName
in classDynamicMethod
- Returns:
- the base name for the method
-
isNotImplemented
public boolean isNotImplemented()Description copied from class:DynamicMethod
Whether this method is "not implemented". This is primarily to support Ruby 1.9's behavior of respond_to? yielding false if the feature in question is unsupported (but still having the method defined).- Overrides:
isNotImplemented
in classDynamicMethod
- Returns:
- is this a method which is marked as not implemented
-
setNotImplemented
public void setNotImplemented(boolean setNotImplemented) Description copied from class:DynamicMethod
Set whether this method is "not implemented".- Overrides:
setNotImplemented
in classDynamicMethod
- Parameters:
setNotImplemented
- is this not implement or not
-
getMethodData
Description copied from class:DynamicMethod
Additional metadata about this method.- Overrides:
getMethodData
in classDynamicMethod
- Returns:
- method data (defined in sub classes)
-
getInstanceVariableNames
- Overrides:
getInstanceVariableNames
in classDynamicMethod
-
setHandle
Description copied from class:DynamicMethod
Set the "handle" associated with this DynamicMethod.- Overrides:
setHandle
in classDynamicMethod
- Parameters:
handle
- the handle
-
getHandle
Description copied from class:DynamicMethod
Get the "handle" associated with this DynamicMethod.- Overrides:
getHandle
in classDynamicMethod
- Returns:
- the handle
-
isRefined
public boolean isRefined()- Overrides:
isRefined
in classDynamicMethod
-
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.
-
equals
-
hashCode
public int hashCode()
-