Top Description Methods
org.jruby.embed

public Interface EmbedRubyObjectAdapter

extends RubyObjectAdapter
Known Direct Implementers
org.jruby.embed.internal.EmbedRubyObjectAdapterImpl
Imports
org.jruby.RubyObjectAdapter, org.jruby.runtime.Block

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 TypeMethod and Description
public Object

Returns:

an instance automatically converted from Ruby to Java
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Object...
are method arguments.
args
)

Executes a method defined in Ruby script.

public Object

Returns:

an instance of automatically converted Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Block
is a block to be executed in this method
block
,
Object...
is an array of method arguments except a block
args
)

Executes a method defined in Ruby script.

public <T> T

Returns:

an instance of requested Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Class<T>
is the type we want it to convert to
returnType
)

Executes a method defined in Ruby script.

public <T> T

Returns:

an instance of requested Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Object
is an method argument
singleArg
,
Class<T>
returnType is the type we want it to convert to
returnType
)

Executes a method defined in Ruby script.

public <T> T

Returns:

an instance of requested Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Object[]
is an array of method arguments
args
,
Class<T>
is the type we want it to convert to
returnType
)

Executes a method defined in Ruby script.

public <T> T

Returns:

an instance of requested Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Object[]
is an array of method arguments except a block
args
,
Block
is a block to be executed in this method
block
,
Class<T>
is the type we want it to convert to
returnType
)

Executes a method defined in Ruby script.

public <T> T

Returns:

an instance of requested Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Class<T>
is the type we want it to convert to
returnType
,
EmbedEvalUnit
is parsed unit
unit
)

Executes a method defined in Ruby script.

public <T> T

Returns:

an instance of requested Java type
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Object[]
is an array of method arguments
args
,
Class<T>
is the type we want it to convert to
returnType
,
EmbedEvalUnit
is parsed unit
unit
)

Executes a method defined in Ruby script.

public <T> T

Returns:

is the type we want it to convert to
callMethod
(Object
is an instance that will receive this method call
receiver
,
String
is a method name to be called
methodName
,
Object[]
is an array of method arguments except a block
args
,
Block
is a block to be executed in this method
block
,
Class<T>
is the type we want it to convert to
returnType
,
EmbedEvalUnit
is parsed unit
unit
)

Executes a method defined in Ruby script.

public <T> T

Returns:

is the type we want it to convert to
callSuper
(Object
is an instance that will receive this method call
receiver
,
Object[]
is an array of method arguments
args
,
Class<T>
is the type we want it to convert to
returnType
)

public <T> T

Returns:

is the type we want it to convert to
callSuper
(Object
is an instance that will receive this method call
receiver
,
Object[]
is an array of method arguments except a block
args
,
Block
is a block to be executed in this method
block
,
Class<T>
is the type we want it to convert to
returnType
)

public <T> T

Returns:

an instance of requested Java type
runRubyMethod
(Class<T>
is the type we want it to convert to
returnType
,
Object
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.
receiver
,
String
is a method name to be called
methodName
,
Block
is an optional Block object. Send null for no block.
block
,
Object...
is an array of method arguments
args
)

Executes a method defined in Ruby script.

Inherited from org.jruby.RubyObjectAdapter:
callMethodcallMethodcallMethodcallMethodcallSupercallSuperconvertToJavaArrayconvertToRubyIntegerconvertToRubyStringgetInstanceVariableisKindOfsetInstanceVariable

Method Detail

callMethodback to summary
public Object callMethod(Object receiver, String methodName, Object... args)

Executes a method defined in Ruby script.

Parameters
receiver:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

args:Object[]

are method arguments.

Returns:Object

an instance automatically converted from Ruby to Java

callMethodback to summary
public Object callMethod(Object receiver, String methodName, Block block, Object... args)

Executes a method defined in Ruby script. This method is used when a Ruby method has a block in its arguments.

Parameters
receiver:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

block:Block

is a block to be executed in this method

args:Object[]

is an array of method arguments except a block

Returns:Object

an instance of automatically converted Java type

callMethodback to summary
public <T> T callMethod(Object receiver, String methodName, Class<T> returnType)

Executes a method defined in Ruby script. This method is used when a Ruby method does not have any argument.

Parameters
receiver:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

returnType:Class<T>

is the type we want it to convert to

Returns:T

an instance of requested Java type

callMethodback to summary
public <T> T callMethod(Object receiver, String methodName, Object singleArg, Class<T> returnType)

Executes a method defined in Ruby script. This method is used when a Ruby method have only one argument.

Parameters
receiver:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

singleArg:Object

is an method argument

returnType:Class<T>

returnType is the type we want it to convert to

Returns:T

an instance of requested Java type

callMethodback to summary
public <T> T callMethod(Object receiver, String methodName, Object[] args, Class<T> returnType)

Executes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments.

Parameters
receiver:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

args:Object[]

is an array of method arguments

returnType:Class<T>

is the type we want it to convert to

Returns:T

an instance of requested Java type

callMethodback to summary
public <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:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

args:Object[]

is an array of method arguments except a block

block:Block

is a block to be executed in this method

returnType:Class<T>

is the type we want it to convert to

Returns:T

an instance of requested Java type

callMethodback to summary
public <T> T callMethod(Object receiver, String methodName, Class<T> returnType, EmbedEvalUnit unit)

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:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

returnType:Class<T>

is the type we want it to convert to

unit:EmbedEvalUnit

is parsed unit

Returns:T

an instance of requested Java type

callMethodback to summary
public <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:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

args:Object[]

is an array of method arguments

returnType:Class<T>

is the type we want it to convert to

unit:EmbedEvalUnit

is parsed unit

Returns:T

an instance of requested Java type

callMethodback to summary
public <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:Object

is an instance that will receive this method call

methodName:String

is a method name to be called

args:Object[]

is an array of method arguments except a block

block:Block

is a block to be executed in this method

returnType:Class<T>

is the type we want it to convert to

unit:EmbedEvalUnit

is parsed unit

Returns:T

is the type we want it to convert to

callSuperback to summary
public <T> T callSuper(Object receiver, Object[] args, Class<T> returnType)
Parameters
receiver:Object

is an instance that will receive this method call

args:Object[]

is an array of method arguments

returnType:Class<T>

is the type we want it to convert to

Returns:T

is the type we want it to convert to

callSuperback to summary
public <T> T callSuper(Object receiver, Object[] args, Block block, Class<T> returnType)
Parameters
receiver:Object

is an instance that will receive this method call

args:Object[]

is an array of method arguments except a block

block:Block

is a block to be executed in this method

returnType:Class<T>

is the type we want it to convert to

Returns:T

is the type we want it to convert to

runRubyMethodback to summary
public <T> T runRubyMethod(Class<T> returnType, Object receiver, String methodName, Block block, Object... args)

Executes a method defined in Ruby script.

Parameters
returnType:Class<T>

is the type we want it to convert to

receiver:Object

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:String

is a method name to be called

block:Block

is an optional Block object. Send null for no block.

args:Object[]

is an array of method arguments

Returns:T

an instance of requested Java type