Top Description Inners Fields Constructors Methods
org.jruby.embed.internal

public Class EmbedRubyObjectAdapterImpl

extends Object
implements EmbedRubyObjectAdapter
Class Inheritance
All Implemented Interfaces
org.jruby.embed.EmbedRubyObjectAdapter, org.jruby.RubyObjectAdapter
Imports
org.jruby.Ruby, .RubyInteger, .RubyModule, .RubyObject, .RubyObjectAdapter, .RubyString, org.jruby.embed.EmbedEvalUnit, .EmbedRubyObjectAdapter, .InvokeFailedException, .ScriptingContainer, org.jruby.embed.variable.BiVariable, .InstanceVariable, org.jruby.javasupport.Java, .JavaEmbedUtils, .JavaUtil, org.jruby.runtime.DynamicScope, .Helpers, .Block, .ThreadContext, org.jruby.runtime.builtin.IRubyObject

Implementation of EmbedRubyObjectAdapter. Users get an instance of this class by newObjectAdapter() method of ScriptingContainer.
Author
Yoko Harada <[email protected]>

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final RubyObjectAdapter
private final ScriptingContainer
private final boolean

Constructor Summary

AccessConstructor and Description
public
public
EmbedRubyObjectAdapterImpl(ScriptingContainer container, boolean wrapExceptions)

Method Summary

Modifier and TypeMethod and Description
private void
private void
public IRubyObject
public IRubyObject
public IRubyObject
public IRubyObject
callMethod(IRubyObject receiver, String methodName, IRubyObject[] args, Block block)

Implements org.jruby.RubyObjectAdapter.callMethod.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public Object
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public Object
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Executes a method defined in Ruby script.

public IRubyObject
public IRubyObject
public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

private static IRubyObject[]
convertArgs(final Ruby runtime, final Object[] args)

public IRubyObject[]
public RubyInteger
public RubyString
private <T> T
doInvokeMethod(Class<T> returnType, IRubyObject rubyReceiver, String methodName, Block block, EmbedEvalUnit unit, Object... args)

private <T> T
doInvokeSuper(Class<T> returnType, IRubyObject rubyReceiver, Block block, EmbedEvalUnit unit, Object... args)

public IRubyObject
private IRubyObject
private IRubyObject
public boolean
public <T> T
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
)

Implements org.jruby.embed.EmbedRubyObjectAdapter.runRubyMethod.

Executes a method defined in Ruby script.

public IRubyObject
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

adapterback to summary
private final RubyObjectAdapter adapter
containerback to summary
private final ScriptingContainer container
wrapExceptionsback to summary
private final boolean wrapExceptions

Constructor Detail

EmbedRubyObjectAdapterImplback to summary
public EmbedRubyObjectAdapterImpl(ScriptingContainer container)
EmbedRubyObjectAdapterImplback to summary
public EmbedRubyObjectAdapterImpl(ScriptingContainer container, boolean wrapExceptions)

Method Detail

afterSharingVariablesCallback to summary
private void afterSharingVariablesCall(final ThreadContext context)
beforeSharingVariablesCallback to summary
private void beforeSharingVariablesCall(final ThreadContext context, EmbedEvalUnit unit)
callMethodback to summary
public IRubyObject callMethod(IRubyObject receiver, String methodName)

Implements org.jruby.RubyObjectAdapter.callMethod.

callMethodback to summary
public IRubyObject callMethod(IRubyObject receiver, String methodName, IRubyObject singleArg)

Implements org.jruby.RubyObjectAdapter.callMethod.

callMethodback to summary
public IRubyObject callMethod(IRubyObject receiver, String methodName, IRubyObject[] args)

Implements org.jruby.RubyObjectAdapter.callMethod.

callMethodback to summary
public IRubyObject callMethod(IRubyObject receiver, String methodName, IRubyObject[] args, Block block)

Implements org.jruby.RubyObjectAdapter.callMethod.

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

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.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: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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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

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

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callMethod.

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

callSuperback to summary
public IRubyObject callSuper(IRubyObject receiver, IRubyObject[] args)

Implements org.jruby.RubyObjectAdapter.callSuper.

callSuperback to summary
public IRubyObject callSuper(IRubyObject receiver, IRubyObject[] args, Block block)

Implements org.jruby.RubyObjectAdapter.callSuper.

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

Implements org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

Parameters
receiver:Object

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is an instance that will receive this method call

args:Object[]

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is an array of method arguments

returnType:Class<T>

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is the type we want it to convert to

Returns:T

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

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)

Implements org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

Parameters
receiver:Object

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is an instance that will receive this method call

args:Object[]

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is an array of method arguments except a block

block:Block

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is a block to be executed in this method

returnType:Class<T>

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is the type we want it to convert to

Returns:T

Doc from org.jruby.embed.EmbedRubyObjectAdapter.callSuper.

is the type we want it to convert to

convertArgsback to summary
private static IRubyObject[] convertArgs(final Ruby runtime, final Object[] args)
Annotations
@SuppressWarnings:deprecation
convertToJavaArrayback to summary
public IRubyObject[] convertToJavaArray(IRubyObject array)

Implements org.jruby.RubyObjectAdapter.convertToJavaArray.

convertToRubyIntegerback to summary
public RubyInteger convertToRubyInteger(IRubyObject obj)

Implements org.jruby.RubyObjectAdapter.convertToRubyInteger.

convertToRubyStringback to summary
public RubyString convertToRubyString(IRubyObject obj)

Implements org.jruby.RubyObjectAdapter.convertToRubyString.

doInvokeMethodback to summary
private <T> T doInvokeMethod(Class<T> returnType, IRubyObject rubyReceiver, String methodName, Block block, EmbedEvalUnit unit, Object... args)
doInvokeSuperback to summary
private <T> T doInvokeSuper(Class<T> returnType, IRubyObject rubyReceiver, Block block, EmbedEvalUnit unit, Object... args)
getInstanceVariableback to summary
public IRubyObject getInstanceVariable(IRubyObject obj, String variableName)

Implements org.jruby.RubyObjectAdapter.getInstanceVariable.

getReceiverObjectback to summary
private IRubyObject getReceiverObject(Object receiver)
getTopSelfback to summary
private IRubyObject getTopSelf()
isKindOfback to summary
public boolean isKindOf(IRubyObject value, RubyModule rubyModule)

Implements org.jruby.RubyObjectAdapter.isKindOf.

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

Implements org.jruby.embed.EmbedRubyObjectAdapter.runRubyMethod.

Doc from org.jruby.embed.EmbedRubyObjectAdapter.runRubyMethod.

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

setInstanceVariableback to summary
public IRubyObject setInstanceVariable(IRubyObject obj, String variableName, IRubyObject value)

Implements org.jruby.RubyObjectAdapter.setInstanceVariable.

org.jruby.embed.internal back to summary

public final Enum EmbedRubyObjectAdapterImpl.MethodType

extends Enum<EmbedRubyObjectAdapterImpl.MethodType>
Class Inheritance
Annotations
@Deprecated

Deprecated

Field Summary

Modifier and TypeField and Description
public static final EmbedRubyObjectAdapterImpl.MethodType
CALLMETHOD

References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.
public static final EmbedRubyObjectAdapterImpl.MethodType
CALLMETHOD_NOARG

References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.
public static final EmbedRubyObjectAdapterImpl.MethodType
CALLMETHOD_WITHBLOCK

References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.
public static final EmbedRubyObjectAdapterImpl.MethodType
CALLSUPER

References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.
public static final EmbedRubyObjectAdapterImpl.MethodType
CALLSUPER_WITHBLOCK

References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static EmbedRubyObjectAdapterImpl.MethodType
valueOf(String name)
References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

public static EmbedRubyObjectAdapterImpl.MethodType[]
values()
References Deprecated EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CALLMETHODback to summary
public static final EmbedRubyObjectAdapterImpl.MethodType CALLMETHOD

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

CALLMETHOD_NOARGback to summary
public static final EmbedRubyObjectAdapterImpl.MethodType CALLMETHOD_NOARG

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

CALLMETHOD_WITHBLOCKback to summary
public static final EmbedRubyObjectAdapterImpl.MethodType CALLMETHOD_WITHBLOCK

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

CALLSUPERback to summary
public static final EmbedRubyObjectAdapterImpl.MethodType CALLSUPER

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

CALLSUPER_WITHBLOCKback to summary
public static final EmbedRubyObjectAdapterImpl.MethodType CALLSUPER_WITHBLOCK

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructor Detail

MethodTypeback to summary
private MethodType()

Method Detail

valueOfback to summary
public static EmbedRubyObjectAdapterImpl.MethodType valueOf(String name)

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

valuesback to summary
public static EmbedRubyObjectAdapterImpl.MethodType[] values()

References Deprecated

EmbedRubyObjectAdapterImpl.MethodType is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.