|
||||||||||
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
Deprecated. |
Field Summary | |
---|---|
static boolean |
CAN_LOAD_BYTECODE
A test to see if we can load bytecode dynamically, so we know whether InvocationMethodFactory will work. |
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 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 CompiledBlockCallback |
getBlockCallback(java.lang.String method,
java.lang.String file,
int line,
java.lang.Object scriptObject)
Get a CompiledBlockCallback for the specified block |
abstract CompiledBlockCallback19 |
getBlockCallback19(java.lang.String method,
java.lang.String file,
int line,
java.lang.Object scriptObject)
Get a CompiledBlockCallback for the specified block |
byte[] |
getBlockCallback19Offline(java.lang.String method,
java.lang.String file,
int line,
java.lang.String classPath)
Get a CompiledBlockCallback for the specified block, returning the bytes but not loading the class. |
byte[] |
getBlockCallbackOffline(java.lang.String method,
java.lang.String file,
int line,
java.lang.String classPath)
Get a CompiledBlockCallback for the specified block, returning the bytes but not loading the class. |
abstract DynamicMethod |
getCompiledMethod(RubyModule implementationClass,
java.lang.String method,
Arity arity,
Visibility visibility,
StaticScope scope,
java.lang.Object scriptObject,
CallConfiguration callConfig,
ISourcePosition position,
java.lang.String parameterDesc)
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,
ISourcePosition position,
java.lang.String parameterDesc)
Like getCompiledMethod, but postpones any heavy lifting involved in creating the method until first invocation. |
byte[] |
getCompiledMethodOffline(java.lang.String method,
java.lang.String classPath,
java.lang.String invokerPath,
Arity arity,
StaticScope scope,
CallConfiguration callConfig,
java.lang.String filename,
int line)
Like getCompiledMethod, but produces the actual bytes for the compiled method handle rather than loading and constructing it. |
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
public static final boolean CAN_LOAD_BYTECODE
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, ISourcePosition position, java.lang.String parameterDesc)
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.position
- The position to use when generating traceable handles.
public byte[] getCompiledMethodOffline(java.lang.String method, java.lang.String classPath, java.lang.String invokerPath, Arity arity, StaticScope scope, CallConfiguration callConfig, java.lang.String filename, int line)
method
- The name of the methodclassPath
- The path-like (with / instead of .) name of the classinvokerPath
- The path-line name of the invoker to generatearity
- The Arity of the methodscope
- The methods static scoping information.callConfig
- The call configuration to use for this method.position
- The position to use when generating traceable handles.
public abstract DynamicMethod getCompiledMethodLazily(RubyModule implementationClass, java.lang.String method, Arity arity, Visibility visibility, StaticScope scope, java.lang.Object scriptObject, CallConfiguration callConfig, ISourcePosition position, java.lang.String parameterDesc)
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
public abstract CompiledBlockCallback getBlockCallback(java.lang.String method, java.lang.String file, int line, java.lang.Object scriptObject)
method
- The name of the methodscriptObject
- The object in which the method can be found
public abstract CompiledBlockCallback19 getBlockCallback19(java.lang.String method, java.lang.String file, int line, java.lang.Object scriptObject)
method
- The name of the methodscriptObject
- The object in which the method can be found
public byte[] getBlockCallbackOffline(java.lang.String method, java.lang.String file, int line, java.lang.String classPath)
method
- The name of the methodclassPath
- The /-based name of the class containing the method
public byte[] getBlockCallback19Offline(java.lang.String method, java.lang.String file, int line, java.lang.String classPath)
method
- The name of the methodclassPath
- The /-based name of the class containing the method
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |