Top Fields Constructors Methods
org.jruby.embed.variable

pack-priv abstract Class AbstractVariable

extends Object
implements BiVariable
Class Inheritance
All Implemented Interfaces
org.jruby.embed.variable.BiVariable
Known Direct Subclasses
org.jruby.embed.variable.Argv, org.jruby.embed.variable.ClassVariable, org.jruby.embed.variable.Constant, org.jruby.embed.variable.GlobalVariable, org.jruby.embed.variable.InstanceVariable, org.jruby.embed.variable.PersistentLocalVariable, org.jruby.embed.variable.TransientLocalVariable
Imports
org.jruby.Ruby, .RubyModule, .RubyObject, org.jruby.javasupport.JavaEmbedUtils, org.jruby.parser.StaticScope, org.jruby.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject

Author
Yoko Harada <[email protected]>

Field Summary

Modifier and TypeField and Description
protected volatile boolean
protected volatile Object
protected volatile Class<T>
protected final String
protected final IRubyObject
protected volatile IRubyObject

Constructor Summary

AccessConstructor and Description
protected
AbstractVariable(IRubyObject receiver, String name, boolean fromRuby)

Constructor used when this variable is originaed from Java.

protected
AbstractVariable(IRubyObject
a receiver object that this variable/constant is originally in. When the variable/constant is originated from Ruby, receiver may not be null.
receiver
,
String name, boolean fromRuby, IRubyObject rubyObject)

Constructor when the variable is originated from Ruby.

Method Summary

Modifier and TypeMethod and Description
pack-priv final ThreadContext
public synchronized Object
getJavaObject()

Implements org.jruby.embed.variable.BiVariable.getJavaObject.

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

public String
getName()

Implements org.jruby.embed.variable.BiVariable.getName.

Returns a name of the variable this object holds.

public IRubyObject
getReceiver()

Implements org.jruby.embed.variable.BiVariable.getReceiver.

Returns the original receiver where this variable has been retrieved.

protected static RubyModule
getRubyClass(final Ruby runtime)

public IRubyObject
getRubyObject()

Implements org.jruby.embed.variable.BiVariable.getRubyObject.

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

pack-priv final Ruby
pack-priv final RubyObject
pack-priv static RubyObject
getTopSelf(final IRubyObject receiver)

public boolean

Returns:

true if identical otherwise false
isReceiverIdentical
(final RubyObject receiver)

Implements org.jruby.embed.variable.BiVariable.isReceiverIdentical.

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

protected static boolean
isValidName(String pattern, Object name)

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

Implements org.jruby.embed.variable.BiVariable.setJavaObject.

Sets a Java object as a value of this object.

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

Implements org.jruby.embed.variable.BiVariable.setRubyObject.

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

protected synchronized void
updateByJavaObject(final Ruby runtime, Object... values)

protected synchronized void
updateRubyObject(final IRubyObject rubyObject)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fromRubyback to summary
protected volatile boolean fromRuby
javaObjectback to summary
protected volatile Object javaObject
javaTypeback to summary
protected volatile Class<T> javaType
nameback to summary
protected final String name
receiverback to summary
protected final IRubyObject receiver
rubyObjectback to summary
protected volatile IRubyObject rubyObject

Constructor Detail

AbstractVariableback to summary
protected AbstractVariable(IRubyObject receiver, String name, boolean fromRuby)

Constructor used when this variable is originaed from Java.

AbstractVariableback to summary
protected AbstractVariable(IRubyObject receiver, String name, boolean fromRuby, IRubyObject rubyObject)

Constructor when the variable is originated from Ruby.

Parameters
receiver:IRubyObject

a receiver object that this variable/constant is originally in. When the variable/constant is originated from Ruby, receiver may not be null.

Method Detail

getCurrentContextback to summary
pack-priv final ThreadContext getCurrentContext()
getJavaObjectback to summary
public synchronized Object getJavaObject()

Implements org.jruby.embed.variable.BiVariable.getJavaObject.

Doc from org.jruby.embed.variable.BiVariable.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()

Implements org.jruby.embed.variable.BiVariable.getName.

Doc from org.jruby.embed.variable.BiVariable.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()

Implements org.jruby.embed.variable.BiVariable.getReceiver.

Doc from org.jruby.embed.variable.BiVariable.getReceiver.

Returns the original receiver where this variable has been retrieved.

Returns:IRubyObject

an original receiver.

getRubyClassback to summary
protected static RubyModule getRubyClass(final Ruby runtime)
getRubyObjectback to summary
public IRubyObject getRubyObject()

Implements org.jruby.embed.variable.BiVariable.getRubyObject.

Doc from org.jruby.embed.variable.BiVariable.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.

getRuntimeback to summary
pack-priv final Ruby getRuntime()
getTopSelfback to summary
pack-priv final RubyObject getTopSelf()
getTopSelfback to summary
pack-priv static RubyObject getTopSelf(final IRubyObject receiver)
isReceiverIdenticalback to summary
public boolean isReceiverIdentical(final RubyObject receiver)

Implements org.jruby.embed.variable.BiVariable.isReceiverIdentical.

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

Returns:boolean

true if identical otherwise false

isValidNameback to summary
protected static boolean isValidName(String pattern, Object name)
setJavaObjectback to summary
public void setJavaObject(final Ruby runtime, Object javaObject)

Implements org.jruby.embed.variable.BiVariable.setJavaObject.

Doc from org.jruby.embed.variable.BiVariable.setJavaObject.

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(final IRubyObject rubyObject)

Implements org.jruby.embed.variable.BiVariable.setRubyObject.

Doc from org.jruby.embed.variable.BiVariable.setRubyObject.

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.

updateByJavaObjectback to summary
protected synchronized void updateByJavaObject(final Ruby runtime, Object... values)
updateRubyObjectback to summary
protected synchronized void updateRubyObject(final IRubyObject rubyObject)