public abstract class MethodFactory extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
MethodFactory.MethodDefiningCallback
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
CAN_LOAD_BYTECODE
A test to see if we can load bytecode dynamically, so we know whether InvocationMethodFactory will work.
|
static Class[] |
COMPILED_METHOD_PARAMS
A Class[] representing the signature of compiled Ruby method.
|
Constructor and Description |
---|
MethodFactory() |
Modifier and Type | Method and Description |
---|---|
static MethodFactory |
createFactory(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,
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(String method,
String file,
int line,
Object scriptObject)
Get a CompiledBlockCallback for the specified block
|
abstract CompiledBlockCallback19 |
getBlockCallback19(String method,
String file,
int line,
Object scriptObject)
Get a CompiledBlockCallback for the specified block
|
byte[] |
getBlockCallback19Offline(String method,
String file,
int line,
String classPath)
Get a CompiledBlockCallback for the specified block, returning the bytes
but not loading the class.
|
byte[] |
getBlockCallbackOffline(String method,
String file,
int line,
String classPath)
Get a CompiledBlockCallback for the specified block, returning the bytes
but not loading the class.
|
abstract DynamicMethod |
getCompiledMethod(RubyModule implementationClass,
String rubyName,
String javaName,
Arity arity,
Visibility visibility,
StaticScope scope,
Object scriptObject,
CallConfiguration callConfig,
ISourcePosition position,
String parameterDesc)
Get a new method handle based on the target JRuby-compiled method.
|
abstract DynamicMethod |
getCompiledMethodLazily(RubyModule implementationClass,
String rubyName,
String javaName,
Arity arity,
Visibility visibility,
StaticScope scope,
Object scriptObject,
CallConfiguration callConfig,
ISourcePosition position,
String parameterDesc)
Like getCompiledMethod, but postpones any heavy lifting involved in
creating the method until first invocation.
|
byte[] |
getCompiledMethodOffline(String rubyName,
String javaName,
String classPath,
String invokerPath,
Arity arity,
StaticScope scope,
CallConfiguration callConfig,
String filename,
int line)
Like getCompiledMethod, but produces the actual bytes for the compiled
method handle rather than loading and constructing it.
|
public static final Class[] COMPILED_METHOD_PARAMS
public static final boolean CAN_LOAD_BYTECODE
public static MethodFactory createFactory(ClassLoader classLoader)
classLoader
- The classloader to use for searching for and
dynamically loading code.public abstract DynamicMethod getCompiledMethod(RubyModule implementationClass, String rubyName, String javaName, Arity arity, Visibility visibility, StaticScope scope, Object scriptObject, CallConfiguration callConfig, ISourcePosition position, String parameterDesc)
implementationClass
- The class to which the method will be bound.rubyName
- The Ruby method name to which the method will bindjavaName
- 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(String rubyName, String javaName, String classPath, String invokerPath, Arity arity, StaticScope scope, CallConfiguration callConfig, String filename, int line)
rubyName
- The Ruby method name to which the method will bindjavaName
- 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, String rubyName, String javaName, Arity arity, Visibility visibility, StaticScope scope, Object scriptObject, CallConfiguration callConfig, ISourcePosition position, String parameterDesc)
implementationClass
- The class to which the method will be bound.rubyName
- The Ruby method name to which the method will bindjavaName
- 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, List<JavaMethodDescriptor> desc)
implementationClass
- The target class or module on which the method
will be bound.descs
- A list of JavaMethodDescriptors describing the target methodspublic 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 methodpublic abstract CompiledBlockCallback getBlockCallback(String method, String file, int line, Object scriptObject)
method
- The name of the methodscriptObject
- The object in which the method can be foundpublic abstract CompiledBlockCallback19 getBlockCallback19(String method, String file, int line, Object scriptObject)
method
- The name of the methodscriptObject
- The object in which the method can be foundpublic byte[] getBlockCallbackOffline(String method, String file, int line, String classPath)
method
- The name of the methodclassPath
- The /-based name of the class containing the methodpublic byte[] getBlockCallback19Offline(String method, String file, int line, String classPath)
method
- The name of the methodclassPath
- The /-based name of the class containing the methodCopyright © 2001-2014 JRuby. All Rights Reserved.