org.jruby.embed.internal
Class EmbedRubyObjectAdapterImpl

java.lang.Object
  extended by org.jruby.embed.internal.EmbedRubyObjectAdapterImpl
All Implemented Interfaces:
EmbedRubyObjectAdapter, RubyObjectAdapter

public class EmbedRubyObjectAdapterImpl
extends java.lang.Object
implements EmbedRubyObjectAdapter

Implementation of EmbedRubyObjectAdapter. Users get an instance of this class by newObjectAdapter() method of ScriptingContainer.

Author:
Yoko Harada

Nested Class Summary
static class EmbedRubyObjectAdapterImpl.MethodType
           
 
Constructor Summary
EmbedRubyObjectAdapterImpl(ScriptingContainer container)
           
 
Method Summary
 IRubyObject callMethod(IRubyObject receiver, java.lang.String methodName)
           
 IRubyObject callMethod(IRubyObject receiver, java.lang.String methodName, IRubyObject singleArg)
           
 IRubyObject callMethod(IRubyObject receiver, java.lang.String methodName, IRubyObject[] args)
           
 IRubyObject callMethod(IRubyObject receiver, java.lang.String methodName, IRubyObject[] args, Block block)
           
 java.lang.Object callMethod(java.lang.Object receiver, java.lang.String methodName, Block block, java.lang.Object... args)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Class<T> returnType)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Class<T> returnType, EmbedEvalUnit unit)
          Executes a method defined in Ruby script.
 java.lang.Object callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Object... args)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, Block block, java.lang.Class<T> returnType)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, Block block, java.lang.Class<T> returnType, EmbedEvalUnit unit)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<T> returnType)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<T> returnType, EmbedEvalUnit unit)
          Executes a method defined in Ruby script.
<T> T
callMethod(java.lang.Object receiver, java.lang.String methodName, java.lang.Object singleArg, java.lang.Class<T> returnType)
          Executes a method defined in Ruby script.
 IRubyObject callSuper(IRubyObject receiver, IRubyObject[] args)
           
 IRubyObject callSuper(IRubyObject receiver, IRubyObject[] args, Block block)
           
<T> T
callSuper(java.lang.Object receiver, java.lang.Object[] args, Block block, java.lang.Class<T> returnType)
           
<T> T
callSuper(java.lang.Object receiver, java.lang.Object[] args, java.lang.Class<T> returnType)
           
 IRubyObject[] convertToJavaArray(IRubyObject array)
           
 RubyInteger convertToRubyInteger(IRubyObject obj)
           
 RubyString convertToRubyString(IRubyObject obj)
           
 IRubyObject getInstanceVariable(IRubyObject obj, java.lang.String variableName)
           
 boolean isKindOf(IRubyObject value, RubyModule rubyModule)
           
 IRubyObject setInstanceVariable(IRubyObject obj, java.lang.String variableName, IRubyObject value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbedRubyObjectAdapterImpl

public EmbedRubyObjectAdapterImpl(ScriptingContainer container)
Method Detail

isKindOf

public boolean isKindOf(IRubyObject value,
                        RubyModule rubyModule)
Specified by:
isKindOf in interface RubyObjectAdapter

convertToJavaArray

public IRubyObject[] convertToJavaArray(IRubyObject array)
Specified by:
convertToJavaArray in interface RubyObjectAdapter

convertToRubyInteger

public RubyInteger convertToRubyInteger(IRubyObject obj)
Specified by:
convertToRubyInteger in interface RubyObjectAdapter

convertToRubyString

public RubyString convertToRubyString(IRubyObject obj)
Specified by:
convertToRubyString in interface RubyObjectAdapter

setInstanceVariable

public IRubyObject setInstanceVariable(IRubyObject obj,
                                       java.lang.String variableName,
                                       IRubyObject value)
Specified by:
setInstanceVariable in interface RubyObjectAdapter

getInstanceVariable

public IRubyObject getInstanceVariable(IRubyObject obj,
                                       java.lang.String variableName)
Specified by:
getInstanceVariable in interface RubyObjectAdapter

callMethod

public IRubyObject callMethod(IRubyObject receiver,
                              java.lang.String methodName)
Specified by:
callMethod in interface RubyObjectAdapter

callMethod

public IRubyObject callMethod(IRubyObject receiver,
                              java.lang.String methodName,
                              IRubyObject singleArg)
Specified by:
callMethod in interface RubyObjectAdapter

callMethod

public IRubyObject callMethod(IRubyObject receiver,
                              java.lang.String methodName,
                              IRubyObject[] args)
Specified by:
callMethod in interface RubyObjectAdapter

callMethod

public IRubyObject callMethod(IRubyObject receiver,
                              java.lang.String methodName,
                              IRubyObject[] args,
                              Block block)
Specified by:
callMethod in interface RubyObjectAdapter

callSuper

public IRubyObject callSuper(IRubyObject receiver,
                             IRubyObject[] args)
Specified by:
callSuper in interface RubyObjectAdapter

callSuper

public IRubyObject callSuper(IRubyObject receiver,
                             IRubyObject[] args,
                             Block block)
Specified by:
callSuper in interface RubyObjectAdapter

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Class<T> returnType)
Description copied from interface: EmbedRubyObjectAdapter
Executes a method defined in Ruby script. This method is used when a Ruby method does not have any argument.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
returnType - is the type we want it to convert to
Returns:
an instance of requested Java type

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Object singleArg,
                        java.lang.Class<T> returnType)
Description copied from interface: EmbedRubyObjectAdapter
Executes a method defined in Ruby script. This method is used when a Ruby method have only one argument.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
singleArg - is an method argument
returnType - returnType is the type we want it to convert to
Returns:
an instance of requested Java type

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Object[] args,
                        java.lang.Class<T> returnType)
Description copied from interface: EmbedRubyObjectAdapter
Executes a method defined in Ruby script. This method is used when a Ruby method have multiple arguments.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
args - is an array of method arguments
returnType - is the type we want it to convert to
Returns:
an instance of requested Java type

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Object[] args,
                        Block block,
                        java.lang.Class<T> returnType)
Description copied from interface: EmbedRubyObjectAdapter
Executes 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:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
args - is an array of method arguments except a block
block - is a block to be executed in this method
returnType - is the type we want it to convert to
Returns:
an instance of requested Java type

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Class<T> returnType,
                        EmbedEvalUnit unit)
Description copied from interface: EmbedRubyObjectAdapter
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.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
returnType - is the type we want it to convert to
unit - is parsed unit
Returns:
an instance of requested Java type

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Object[] args,
                        java.lang.Class<T> returnType,
                        EmbedEvalUnit unit)
Description copied from interface: EmbedRubyObjectAdapter
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.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
args - is an array of method arguments
returnType - is the type we want it to convert to
unit - is parsed unit
Returns:
an instance of requested Java type

callMethod

public <T> T callMethod(java.lang.Object receiver,
                        java.lang.String methodName,
                        java.lang.Object[] args,
                        Block block,
                        java.lang.Class<T> returnType,
                        EmbedEvalUnit unit)
Description copied from interface: EmbedRubyObjectAdapter
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.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
args - is an array of method arguments except a block
block - is a block to be executed in this method
returnType - is the type we want it to convert to
unit - is parsed unit
Returns:
is the type we want it to convert to

callSuper

public <T> T callSuper(java.lang.Object receiver,
                       java.lang.Object[] args,
                       java.lang.Class<T> returnType)
Specified by:
callSuper in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
args - is an array of method arguments
returnType - is the type we want it to convert to
Returns:
is the type we want it to convert to

callSuper

public <T> T callSuper(java.lang.Object receiver,
                       java.lang.Object[] args,
                       Block block,
                       java.lang.Class<T> returnType)
Specified by:
callSuper in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
args - is an array of method arguments except a block
block - is a block to be executed in this method
returnType - is the type we want it to convert to
Returns:
is the type we want it to convert to

callMethod

public java.lang.Object callMethod(java.lang.Object receiver,
                                   java.lang.String methodName,
                                   java.lang.Object... args)
Description copied from interface: EmbedRubyObjectAdapter
Executes a method defined in Ruby script.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
args - are method arguments.
Returns:
an instance automatically converted from Ruby to Java

callMethod

public java.lang.Object callMethod(java.lang.Object receiver,
                                   java.lang.String methodName,
                                   Block block,
                                   java.lang.Object... args)
Description copied from interface: EmbedRubyObjectAdapter
Executes a method defined in Ruby script. This method is used when a Ruby method has a block in its arguments.

Specified by:
callMethod in interface EmbedRubyObjectAdapter
Parameters:
receiver - is an instance that will receive this method call
methodName - is a method name to be called
block - is a block to be executed in this method
args - is an array of method arguments except a block
Returns:
an instance of automatically converted Java type


Copyright © 2002-2009 JRuby Team. All Rights Reserved.