|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.embed.variable.GlobalVariable
org.jruby.embed.variable.LocalGlobalVariable
public class LocalGlobalVariable
An implementation of BiVariable for JSR223 style global variable. The assigned name is like a local variables in Java, but a global in Ruby.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jruby.embed.variable.BiVariable |
---|
BiVariable.Type |
Field Summary | |
---|---|
protected boolean |
fromRuby
|
protected IRubyObject |
irubyObject
|
protected java.lang.Object |
javaObject
|
protected java.lang.Class |
javaType
|
protected java.lang.String |
name
|
protected IRubyObject |
receiver
|
Method Summary | |
---|---|
static BiVariable |
getInstance(RubyObject receiver,
java.lang.String name,
java.lang.Object... javaObject)
Returns an instance of this class. |
java.lang.Object |
getJavaObject()
Returns a value of the variable this object holds in Java type. |
java.lang.String |
getName()
Returns a name of the variable this object holds. |
IRubyObject |
getReceiver()
Returns the original receiver where this variable has been retrieved. |
protected RubyModule |
getRubyClass(Ruby runtime)
|
IRubyObject |
getRubyObject()
Returns a value of the variable this object holds in a org.jruby.runtime.builtin.IRubyObject type. |
BiVariable.Type |
getType()
Returns enum type of this variable defined in BiVariable . |
void |
inject()
Injects a global value to a parsed Ruby script. |
static boolean |
isValidName(java.lang.Object name)
Returns true if the given name is a local global type variable. |
protected static boolean |
isValidName(java.lang.String pattern,
java.lang.Object name)
|
void |
remove()
Removes this object from BiVariableMap . |
static void |
retrieve(RubyObject receiver,
BiVariableMap vars)
Retrieves global variables eagerly from Ruby right after the evaluation. |
static void |
retrieveByKey(Ruby runtime,
BiVariableMap vars,
java.lang.String key)
Retrieves a global variable by key from Ruby runtime after the evaluation. |
void |
setRubyObject(IRubyObject rubyObject)
Sets a org.jruby.runtime.builtin.IRubyObject type, Ruby object as a value of this object. |
protected void |
updateByJavaObject(Ruby runtime,
java.lang.Object... values)
|
protected void |
updateRubyObject(IRubyObject rubyObject)
|
Methods inherited from class org.jruby.embed.variable.GlobalVariable |
---|
isPredefined, isReceiverIdentical, retrieve, setJavaObject, tryEagerInjection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final IRubyObject receiver
protected java.lang.String name
protected java.lang.Object javaObject
protected java.lang.Class javaType
protected IRubyObject irubyObject
protected boolean fromRuby
Method Detail |
---|
public static BiVariable getInstance(RubyObject receiver, java.lang.String name, java.lang.Object... javaObject)
BiVariableMap
.
runtime
- Ruby runtimename
- a variable namejavaObject
- Java object that should be assigned to.
public static void retrieve(RubyObject receiver, BiVariableMap vars)
receiver
- receiver object returned when a script is evaluated.vars
- map to save retrieved global variables.public static void retrieveByKey(Ruby runtime, BiVariableMap vars, java.lang.String key)
runtime
- Ruby runtimevars
- map to save a retrieved global variable.key
- name of the global variablepublic BiVariable.Type getType()
BiVariable
.
getType
in interface BiVariable
getType
in class GlobalVariable
public static boolean isValidName(java.lang.Object name)
name
- is a name to be checked.
public void inject()
inject
in interface BiVariable
inject
in class GlobalVariable
public void remove()
BiVariableMap
.
remove
in interface BiVariable
remove
in class GlobalVariable
runtime
- environment where a variable is removed.protected void updateByJavaObject(Ruby runtime, java.lang.Object... values)
protected void updateRubyObject(IRubyObject rubyObject)
public IRubyObject getReceiver()
BiVariable
getReceiver
in interface BiVariable
public java.lang.String getName()
BiVariable
getName
in interface BiVariable
public java.lang.Object getJavaObject()
BiVariable
getJavaObject
in interface BiVariable
public IRubyObject getRubyObject()
BiVariable
getRubyObject
in interface BiVariable
public void setRubyObject(IRubyObject rubyObject)
BiVariable
setRubyObject
in interface BiVariable
rubyObject
- is a variable value to be set.protected RubyModule getRubyClass(Ruby runtime)
protected static boolean isValidName(java.lang.String pattern, java.lang.Object name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |