Package org.jruby.embed.internal
Class EmbedRubyObjectAdapterImpl
java.lang.Object
org.jruby.embed.internal.EmbedRubyObjectAdapterImpl
- All Implemented Interfaces:
EmbedRubyObjectAdapter,RubyObjectAdapter
Implementation of
EmbedRubyObjectAdapter. Users get an instance of this
class by newObjectAdapter() method of ScriptingContainer.- Author:
- Yoko Harada <[email protected]>
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEmbedRubyObjectAdapterImpl(ScriptingContainer container) EmbedRubyObjectAdapterImpl(ScriptingContainer container, boolean wrapExceptions) -
Method Summary
Modifier and TypeMethodDescription<T> TcallMethod(Object receiver, String methodName, Class<T> returnType) Executes a method defined in Ruby script.<T> TcallMethod(Object receiver, String methodName, Class<T> returnType, EmbedEvalUnit unit) Executes a method defined in Ruby script.callMethod(Object receiver, String methodName, Object... args) Executes a method defined in Ruby script.<T> TcallMethod(Object receiver, String methodName, Object[] args, Class<T> returnType) Executes a method defined in Ruby script.<T> TcallMethod(Object receiver, String methodName, Object[] args, Class<T> returnType, EmbedEvalUnit unit) Executes a method defined in Ruby script.<T> TExecutes a method defined in Ruby script.<T> TcallMethod(Object receiver, String methodName, Object[] args, Block block, Class<T> returnType, EmbedEvalUnit unit) Executes a method defined in Ruby script.<T> TcallMethod(Object receiver, String methodName, Object singleArg, Class<T> returnType) Executes a method defined in Ruby script.callMethod(Object receiver, String methodName, Block block, Object... args) Executes a method defined in Ruby script.callMethod(IRubyObject receiver, String methodName) callMethod(IRubyObject receiver, String methodName, IRubyObject singleArg) callMethod(IRubyObject receiver, String methodName, IRubyObject[] args) callMethod(IRubyObject receiver, String methodName, IRubyObject[] args, Block block) <T> T<T> TcallSuper(IRubyObject receiver, IRubyObject[] args) callSuper(IRubyObject receiver, IRubyObject[] args, Block block) convertToJavaArray(IRubyObject array) getInstanceVariable(IRubyObject obj, String variableName) booleanisKindOf(IRubyObject value, RubyModule rubyModule) <T> TExecutes a method defined in Ruby script.setInstanceVariable(IRubyObject obj, String variableName, IRubyObject value)
-
Constructor Details
-
EmbedRubyObjectAdapterImpl
-
EmbedRubyObjectAdapterImpl
-
-
Method Details
-
isKindOf
- Specified by:
isKindOfin interfaceRubyObjectAdapter
-
convertToJavaArray
- Specified by:
convertToJavaArrayin interfaceRubyObjectAdapter
-
convertToRubyInteger
- Specified by:
convertToRubyIntegerin interfaceRubyObjectAdapter
-
convertToRubyString
- Specified by:
convertToRubyStringin interfaceRubyObjectAdapter
-
setInstanceVariable
- Specified by:
setInstanceVariablein interfaceRubyObjectAdapter
-
getInstanceVariable
- Specified by:
getInstanceVariablein interfaceRubyObjectAdapter
-
callMethod
- Specified by:
callMethodin interfaceRubyObjectAdapter
-
callMethod
- Specified by:
callMethodin interfaceRubyObjectAdapter
-
callMethod
- Specified by:
callMethodin interfaceRubyObjectAdapter
-
callMethod
public IRubyObject callMethod(IRubyObject receiver, String methodName, IRubyObject[] args, Block block) - Specified by:
callMethodin interfaceRubyObjectAdapter
-
callSuper
- Specified by:
callSuperin interfaceRubyObjectAdapter
-
callSuper
- Specified by:
callSuperin interfaceRubyObjectAdapter
-
callMethod
Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method does not have any argument.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledreturnType- is the type we want it to convert to- Returns:
- an instance of requested Java type
-
callMethod
Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method have only one argument.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledsingleArg- is an method argumentreturnType- returnType is the type we want it to convert to- Returns:
- an instance of requested Java type
-
callMethod
Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledargs- is an array of method argumentsreturnType- is the type we want it to convert to- Returns:
- an instance of requested Java type
-
callMethod
public <T> T callMethod(Object receiver, String methodName, Object[] args, Block block, Class<T> returnType) Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments, one of which is a block.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledargs- is an array of method arguments except a blockblock- is a block to be executed in this methodreturnType- is the type we want it to convert to- Returns:
- an instance of requested Java type
-
callMethod
public <T> T callMethod(Object receiver, String methodName, Class<T> returnType, EmbedEvalUnit unit) Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method does not have any argument, and users want to inject Ruby's local variables' values from Java.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledreturnType- is the type we want it to convert tounit- is parsed unit- Returns:
- an instance of requested Java type
-
callMethod
public <T> T callMethod(Object receiver, String methodName, Object[] args, Class<T> returnType, EmbedEvalUnit unit) Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments, and users want to inject Ruby's local variables' values from Java.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledargs- is an array of method argumentsreturnType- is the type we want it to convert tounit- is parsed unit- Returns:
- an instance of requested Java type
-
callMethod
public <T> T callMethod(Object receiver, String methodName, Object[] args, Block block, Class<T> returnType, EmbedEvalUnit unit) Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments, one of which is a block, and users want to inject Ruby's local variables' values from Java.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledargs- is an array of method arguments except a blockblock- is a block to be executed in this methodreturnType- is the type we want it to convert tounit- is parsed unit- Returns:
- is the type we want it to convert to
-
callSuper
- Specified by:
callSuperin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callargs- is an array of method argumentsreturnType- is the type we want it to convert to- Returns:
- is the type we want it to convert to
-
callSuper
- Specified by:
callSuperin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callargs- is an array of method arguments except a blockblock- is a block to be executed in this methodreturnType- is the type we want it to convert to- Returns:
- is the type we want it to convert to
-
callMethod
Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledargs- are method arguments.- Returns:
- an instance automatically converted from Ruby to Java
-
callMethod
Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script. This method is used when a Ruby method has a block in its arguments.- Specified by:
callMethodin interfaceEmbedRubyObjectAdapter- Parameters:
receiver- is an instance that will receive this method callmethodName- is a method name to be calledblock- is a block to be executed in this methodargs- is an array of method arguments except a block- Returns:
- an instance of automatically converted Java type
-
runRubyMethod
public <T> T runRubyMethod(Class<T> returnType, Object receiver, String methodName, Block block, Object... args) Description copied from interface:EmbedRubyObjectAdapterExecutes a method defined in Ruby script.- Specified by:
runRubyMethodin interfaceEmbedRubyObjectAdapter- Parameters:
returnType- is the type we want it to convert toreceiver- is an instance that will receive this method call. The receiver can be null or other Java objects. The null will be converted to RubyNil or wrapped in RubyObject.methodName- is a method name to be calledblock- is an optional Block object. Send null for no block.args- is an array of method arguments- Returns:
- an instance of requested Java type
-