Top Description Inners Methods
org.jruby.embed.variable

public Interface BiVariable

Known Direct Implementers
org.jruby.embed.variable.AbstractVariable
Imports
org.jruby.Ruby, .RubyObject, org.jruby.runtime.builtin.IRubyObject

Represents bidirectional, both Java and Ruby, variables. Users don't instantiate BiVariable type objects. Instead, users can get this type object from BiVariableMap after a variable is set to the map. Users can set variables in Java program explicitly through put() methods in ScriptingContainer and BiVariableMap or equivalents. However, variables in Ruby scripts are set in the map implicitly. When variables and constants are used in the script, those are automatically saved in the map converting to this type.
Author
Yoko Harada <[email protected]>

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
BiVariable.Type

Defines a type correspond to Ruby's variables and constant types.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a value in Java type.
getJavaObject
()

Returns a value of the variable this object holds in Java type.

public String

Returns:

a name of the variable
getName
()

Returns a name of the variable this object holds.

public IRubyObject

Returns:

an original receiver.
getReceiver
()

Returns the original receiver where this variable has been retrieved.

public IRubyObject

Returns:

a value in IRubyObject type.
getRubyObject
()

Returns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type.

public BiVariable.Type

Returns:

a type that corresponds to Ruby's variables and constant types.
getType
()

Returns one of the Ruby's variables or constant types defined by Type.

public void
inject()

Injects a variable value to a parsed Ruby script.

public boolean

Returns:

true if identical otherwise false.
isReceiverIdentical
(RubyObject receiver)

Returns true if a given receiver is identical to the receiver this object has.

public void
remove()

Attempts to remove this variable/constant from top self or receiver.

public void
setJavaObject(Ruby
is used to convert a Java object to Ruby object.
runtime
,
Object
is a variable value to be set.
javaObject
)

Sets a Java object as a value of this object.

public void
setRubyObject(IRubyObject
is a variable value to be set.
rubyObject
)

Sets a org.jruby.runtime.builtin.IRubyObject type, Ruby object as a value of this object.

Method Detail

getJavaObjectback to summary
public Object getJavaObject()

Returns a value of the variable this object holds in Java type.

Returns:Object

a value in Java type.

getNameback to summary
public String getName()

Returns a name of the variable this object holds. The name follows Ruby's naming rule.

Returns:String

a name of the variable

getReceiverback to summary
public IRubyObject getReceiver()

Returns the original receiver where this variable has been retrieved.

Returns:IRubyObject

an original receiver.

getRubyObjectback to summary
public IRubyObject getRubyObject()

Returns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type.

Returns:IRubyObject

a value in IRubyObject type.

getTypeback to summary
public BiVariable.Type getType()

Returns one of the Ruby's variables or constant types defined by Type.

Returns:BiVariable.Type

a type that corresponds to Ruby's variables and constant types.

injectback to summary
public void inject()

Injects a variable value to a parsed Ruby script. This method is invoked during EvalUnit#run() is executed. Users don't use this method.

isReceiverIdenticalback to summary
public boolean isReceiverIdentical(RubyObject receiver)

Returns true if a given receiver is identical to the receiver this object has.

Returns:boolean

true if identical otherwise false.

removeback to summary
public void remove()

Attempts to remove this variable/constant from top self or receiver.

setJavaObjectback to summary
public void setJavaObject(Ruby runtime, Object javaObject)

Sets a Java object as a value of this object. At the same time, an equivalent Ruby object is set automatically.

Parameters
runtime:Ruby

is used to convert a Java object to Ruby object.

javaObject:Object

is a variable value to be set.

setRubyObjectback to summary
public void setRubyObject(IRubyObject rubyObject)

Sets a org.jruby.runtime.builtin.IRubyObject type, Ruby object as a value of this object. At the same time, an equivalent Java object is set automatically.

Parameters
rubyObject:IRubyObject

is a variable value to be set.

org.jruby.embed.variable back to summary

public final Enum BiVariable.Type

extends Enum<BiVariable.Type>
Class Inheritance

Defines a type correspond to Ruby's variables and constant types.

Field Summary

Modifier and TypeField and Description
public static final BiVariable.Type
public static final BiVariable.Type
public static final BiVariable.Type
public static final BiVariable.Type
public static final BiVariable.Type
public static final BiVariable.Type
public static final BiVariable.Type

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
public static BiVariable.Type
public static BiVariable.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Argvback to summary
public static final BiVariable.Type Argv
ClassVariableback to summary
public static final BiVariable.Type ClassVariable
Constantback to summary
public static final BiVariable.Type Constant
GlobalVariableback to summary
public static final BiVariable.Type GlobalVariable
InstanceVariableback to summary
public static final BiVariable.Type InstanceVariable
LocalGlobalVariableback to summary
public static final BiVariable.Type LocalGlobalVariable
LocalVariableback to summary
public static final BiVariable.Type LocalVariable

Constructor Detail

Typeback to summary
private Type()

Method Detail

valueOfback to summary
public static BiVariable.Type valueOf(String name)
valuesback to summary
public static BiVariable.Type[] values()