Package org.jruby.embed
Interface EmbedRubyObjectAdapter
- All Superinterfaces:
RubyObjectAdapter
- All Known Implementing Classes:
EmbedRubyObjectAdapterImpl
Wrapper interface of RubyObjectAdapter for embedding. Methods' arguments can have
simple Java objects for easiness. Each methods converts returned object
to a Java type specified in the argument.
- Author:
- Yoko Harada <[email protected]>
-
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.<T> T<T> T<T> TExecutes a method defined in Ruby script.Methods inherited from interface org.jruby.RubyObjectAdapter
callMethod, callMethod, callMethod, callMethod, callSuper, callSuper, convertToJavaArray, convertToRubyInteger, convertToRubyString, getInstanceVariable, isKindOf, setInstanceVariable
-
Method Details
-
callMethod
Executes a method defined in Ruby script.- 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
Executes a method defined in Ruby script. This method is used when a Ruby method has a block in its arguments.- 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
-
callMethod
Executes a method defined in Ruby script. This method is used when a Ruby method does not have any argument.- 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
Executes a method defined in Ruby script. This method is used when a Ruby method have only one argument.- 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
Executes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments.- 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
<T> T callMethod(Object receiver, String methodName, Object[] args, Block block, Class<T> returnType) Executes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments, one of which is a block.- 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
Executes 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.- 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
<T> T callMethod(Object receiver, String methodName, Object[] args, Class<T> returnType, EmbedEvalUnit unit) Executes 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.- 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
<T> T callMethod(Object receiver, String methodName, Object[] args, Block block, Class<T> returnType, EmbedEvalUnit unit) Executes 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.- 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
- 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
- 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
-
runRubyMethod
<T> T runRubyMethod(Class<T> returnType, Object receiver, String methodName, Block block, Object... args) Executes a method defined in Ruby script.- 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
-