Package org.jruby.embed.variable
Class AbstractVariable
java.lang.Object
org.jruby.embed.variable.AbstractVariable
- All Implemented Interfaces:
BiVariable
- Direct Known Subclasses:
Argv,ClassVariable,Constant,GlobalVariable,InstanceVariable,PersistentLocalVariable,TransientLocalVariable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jruby.embed.variable.BiVariable
BiVariable.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Objectprotected Classprotected final Stringprotected final IRubyObjectprotected IRubyObject -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractVariable(IRubyObject receiver, String name, boolean fromRuby) Constructor used when this variable is originaed from Java.protectedAbstractVariable(IRubyObject receiver, String name, boolean fromRuby, IRubyObject rubyObject) Constructor when the variable is originated from Ruby. -
Method Summary
Modifier and TypeMethodDescription(package private) final ThreadContextReturns a value of the variable this object holds in Java type.getName()Returns a name of the variable this object holds.Returns the original receiver where this variable has been retrieved.protected static RubyModulegetRubyClass(Ruby runtime) Returns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type.(package private) final Ruby(package private) final RubyObject(package private) static RubyObjectgetTopSelf(IRubyObject receiver) booleanisReceiverIdentical(RubyObject receiver) Returns true if a given receiver is identical to the receiver this object has.protected static booleanisValidName(String pattern, Object name) voidsetJavaObject(Ruby runtime, Object javaObject) Sets a Java object as a value of this object.voidsetRubyObject(IRubyObject rubyObject) Sets a org.jruby.runtime.builtin.IRubyObject type, Ruby object as a value of this object.protected voidupdateByJavaObject(Ruby runtime, Object... values) protected voidupdateRubyObject(IRubyObject rubyObject) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jruby.embed.variable.BiVariable
getType, inject, remove
-
Field Details
-
receiver
-
name
-
javaObject
-
javaType
-
rubyObject
-
fromRuby
protected boolean fromRuby
-
-
Constructor Details
-
AbstractVariable
Constructor used when this variable is originaed from Java.- Parameters:
runtime-name-fromRuby-values-
-
AbstractVariable
protected AbstractVariable(IRubyObject receiver, String name, boolean fromRuby, IRubyObject rubyObject) Constructor when the variable is originated from Ruby.- Parameters:
receiver- a receiver object that this variable/constant is originally in. When the variable/constant is originated from Ruby, receiver may not be null.name-fromRuby-rubyObject-
-
-
Method Details
-
getRuntime
-
getCurrentContext
-
getTopSelf
-
getTopSelf
-
updateByJavaObject
-
updateRubyObject
-
getReceiver
Description copied from interface:BiVariableReturns the original receiver where this variable has been retrieved.- Specified by:
getReceiverin interfaceBiVariable- Returns:
- an original receiver.
-
isReceiverIdentical
Returns true if a given receiver is identical to the receiver this object has.- Specified by:
isReceiverIdenticalin interfaceBiVariable- Returns:
- true if identical otherwise false
-
getName
Description copied from interface:BiVariableReturns a name of the variable this object holds. The name follows Ruby's naming rule.- Specified by:
getNamein interfaceBiVariable- Returns:
- a name of the variable
-
getJavaObject
Description copied from interface:BiVariableReturns a value of the variable this object holds in Java type.- Specified by:
getJavaObjectin interfaceBiVariable- Returns:
- a value in Java type.
-
setJavaObject
Description copied from interface:BiVariableSets a Java object as a value of this object. At the same time, an equivalent Ruby object is set automatically.- Specified by:
setJavaObjectin interfaceBiVariable- Parameters:
runtime- is used to convert a Java object to Ruby object.javaObject- is a variable value to be set.
-
getRubyObject
Description copied from interface:BiVariableReturns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type.- Specified by:
getRubyObjectin interfaceBiVariable- Returns:
- a value in IRubyObject type.
-
setRubyObject
Description copied from interface:BiVariableSets 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.- Specified by:
setRubyObjectin interfaceBiVariable- Parameters:
rubyObject- is a variable value to be set.
-
getRubyClass
-
isValidName
-