Interface EmbedRubyObjectAdapter

All Superinterfaces:
RubyObjectAdapter
All Known Implementing Classes:
EmbedRubyObjectAdapterImpl

public interface EmbedRubyObjectAdapter extends RubyObjectAdapter
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 Details

    • callMethod

      Object callMethod(Object receiver, String methodName, Object... args)
      Executes a method defined in Ruby script.
      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

      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 - 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
    • callMethod

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

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

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

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

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

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

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

      <T> T callSuper(Object receiver, Object[] args, Class<T> returnType)
      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

      <T> T callSuper(Object receiver, Object[] args, Block block, Class<T> returnType)
      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
    • 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 to
      receiver - 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 called
      block - is an optional Block object. Send null for no block.
      args - is an array of method arguments
      Returns:
      an instance of requested Java type