|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jruby.runtime.MethodFactory
public abstract class MethodFactory
MethodFactory is used to generate "invokers" or "method handles" given a target class, method name, and other characteristics. In order to bind methods into Ruby's reified class hierarchy, we need a way to treat individual methods as objects. Implementers of this class provide that functionality.
| Nested Class Summary | |
|---|---|
static interface |
MethodFactory.MethodDefiningCallback
For batched method construction, the logic necessary to bind resulting method objects into a target module/class must be provided as a callback. |
| Field Summary | |
|---|---|
static java.lang.Class[] |
COMPILED_METHOD_PARAMS
A Class[] representing the signature of compiled Ruby method. |
| Constructor Summary | |
|---|---|
MethodFactory()
|
|
| Method Summary | |
|---|---|
static MethodFactory |
createFactory(java.lang.ClassLoader classLoader)
Based on optional properties, create a new MethodFactory. |
abstract void |
defineIndexedAnnotatedMethods(RubyModule implementationClass,
java.lang.Class containingClass,
MethodFactory.MethodDefiningCallback callback)
Deprecated. |
abstract DynamicMethod |
getAnnotatedMethod(RubyModule implementationClass,
JavaMethodDescriptor desc)
Based on an annotated Java method object, generate a method handle using the annotation and the target signature. |
abstract DynamicMethod |
getAnnotatedMethod(RubyModule implementationClass,
java.util.List<JavaMethodDescriptor> desc)
Based on a list of annotated Java methods, generate a method handle using the annotation and the target signatures. |
abstract DynamicMethod |
getCompiledMethod(RubyModule implementationClass,
java.lang.String method,
Arity arity,
Visibility visibility,
StaticScope scope,
java.lang.Object scriptObject,
CallConfiguration callConfig)
Get a new method handle based on the target JRuby-compiled method. |
abstract DynamicMethod |
getCompiledMethodLazily(RubyModule implementationClass,
java.lang.String method,
Arity arity,
Visibility visibility,
StaticScope scope,
java.lang.Object scriptObject,
CallConfiguration callConfig)
Like getCompiledMethod, but postpones any heavy lifting involved in creating the method until first invocation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.Class[] COMPILED_METHOD_PARAMS
| Constructor Detail |
|---|
public MethodFactory()
| Method Detail |
|---|
public static MethodFactory createFactory(java.lang.ClassLoader classLoader)
classLoader - The classloader to use for searching for and
dynamically loading code.
public abstract DynamicMethod getCompiledMethod(RubyModule implementationClass,
java.lang.String method,
Arity arity,
Visibility visibility,
StaticScope scope,
java.lang.Object scriptObject,
CallConfiguration callConfig)
implementationClass - The class to which the method will be bound.method - The name of the methodarity - The Arity of the methodvisibility - The method's visibility on the target type.scope - The methods static scoping information.scriptObject - An instace of the target compiled method class.callConfig - The call configuration to use for this method.
public abstract DynamicMethod getCompiledMethodLazily(RubyModule implementationClass,
java.lang.String method,
Arity arity,
Visibility visibility,
StaticScope scope,
java.lang.Object scriptObject,
CallConfiguration callConfig)
implementationClass - The class to which the method will be bound.method - The name of the methodarity - The Arity of the methodvisibility - The method's visibility on the target type.scope - The methods static scoping information.scriptObject - An instace of the target compiled method class.callConfig - The call configuration to use for this method.
public abstract DynamicMethod getAnnotatedMethod(RubyModule implementationClass,
java.util.List<JavaMethodDescriptor> desc)
implementationClass - The target class or module on which the method
will be bound.descs - A list of JavaMethodDescriptors describing the target methods
public abstract DynamicMethod getAnnotatedMethod(RubyModule implementationClass,
JavaMethodDescriptor desc)
implementationClass - The target class or module on which the method
will be bound.desc - A JavaMethodDescriptor describing the target method
@Deprecated
public abstract void defineIndexedAnnotatedMethods(RubyModule implementationClass,
java.lang.Class containingClass,
MethodFactory.MethodDefiningCallback callback)
implementationClass - The target class or module on which the method
will be bound.containingClass - The Java class containined annotated methods to
be bound.callback - A callback provided by the caller which handles binding
each method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||