public class VariableAccessor extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
classId
the ID of the class associated with this variable
|
static VariableAccessor |
DUMMY_ACCESSOR
a dummy accessor that will always return null
|
protected int |
index
the index allocated for it in the variable table
|
protected String |
name
the name of the variable
|
protected RubyClass |
realClass
the "real" class associated with this variable
|
Constructor and Description |
---|
VariableAccessor(RubyClass realClass,
String name,
int index,
int classId)
Construct a new VariableAccessor for the given "real" class, name,
variable index, and class ID.
|
Modifier and Type | Method and Description |
---|---|
Object |
get(Object object)
Retrieve the variable's value from the given object.
|
int |
getClassId()
Get the ID of the class associated with this variable.
|
int |
getIndex()
Get the index allocated for this variable.
|
String |
getName()
Get the name of this variable.
|
static Object |
getVariable(RubyBasicObject object,
int index)
Retrieve the variable's value from the given object.
|
void |
set(Object object,
Object value)
Set the value for this variable in the given object.
|
boolean |
verify(Object object)
Verify if this is the correct accessor for the given object.
|
protected final String name
protected final int index
protected final int classId
protected final RubyClass realClass
public static final VariableAccessor DUMMY_ACCESSOR
public VariableAccessor(RubyClass realClass, String name, int index, int classId)
realClass
- the "real" classname
- the variable's nameindex
- the variable's indexclassId
- the class's IDpublic int getClassId()
public int getIndex()
public String getName()
public Object get(Object object)
object
- the object from which to retrieve this variablepublic static Object getVariable(RubyBasicObject object, int index)
object
- the object from which to retrieve the variableindex
- the index of the variablepublic void set(Object object, Object value)
object
- the object into which to set this variablevalue
- the value of the variablepublic boolean verify(Object object)
object
- the object for which to test this accessorCopyright © 2001-2015 JRuby. All Rights Reserved.