public class VariableTableManager
extends java.lang.Object
Constructor and Description |
---|
VariableTableManager(RubyClass realClass)
Construct a new VariableTable Manager for the given "real" class.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clearVariable(RubyBasicObject object,
java.lang.String name) |
void |
deserializeVariables(RubyBasicObject object,
java.io.ObjectInputStream ois) |
java.lang.Object |
getFFIHandle(RubyBasicObject self)
Retrieve the FFI ext handle for the given object.
|
VariableAccessorField |
getFFIHandleAccessorField()
Deprecated.
|
VariableAccessor |
getFFIHandleAccessorForRead()
Retrieve the read accessor for FFI handle.
|
VariableAccessor |
getFFIHandleAccessorForWrite()
Retrieve the write accessor for FFI handle.
|
VariableAccessorField |
getObjectGroupAccessorField()
Deprecated.
|
VariableAccessor |
getObjectGroupAccessorForRead()
Retrieve the read accessor for object group.
|
VariableAccessor |
getObjectGroupAccessorForWrite()
Retrieve the write accessor for object group.
|
long |
getObjectId(RubyBasicObject self)
Get the object_id from a given RubyBasicObject, possibly allocating
space for it.
|
VariableAccessorField |
getObjectIdAccessorField()
Deprecated.
|
VariableAccessor |
getObjectIdAccessorForRead()
Retrieve the read accessor for object_id for reads.
|
VariableAccessor |
getObjectIdAccessorForWrite()
Retrieve the write accessor for object_id.
|
VariableAccessor |
getVariableAccessorForRead(java.lang.String name)
Get the variable accessor for the given name with intent to use it for
reading.
|
VariableAccessor |
getVariableAccessorForVar(java.lang.String name,
java.lang.invoke.MethodHandle getter,
java.lang.invoke.MethodHandle setter) |
VariableAccessor |
getVariableAccessorForWrite(java.lang.String name)
Get the variable accessor for the given name with intent to use it for
writing.
|
java.util.Map<java.lang.String,VariableAccessor> |
getVariableAccessorsForRead()
Get the map of all current variable accessors with intent to read from it.
|
java.lang.String[] |
getVariableNames()
Get an array of all the known instance variable names.
|
java.util.Map<java.lang.String,VariableAccessor> |
getVariableTableCopy()
Get a Map representing all variables registered in the variable table.
|
int |
getVariableTableSize()
Get the size of the variable table, excluding extra vars (object_id,
etc).
|
int |
getVariableTableSizeWithExtras()
Get the size of the variable table, including extra vars (object_etc,
etc).
|
boolean |
hasObjectID()
Whether this table has been used to allocate space for an object_id.
|
boolean |
hasVariables(RubyBasicObject object)
Returns true if object has any variables, defined as:
instance variables
class variables
constants
internal variables, such as those used when marshaling Ranges and Exceptions
|
void |
serializeVariables(RubyBasicObject object,
java.io.ObjectOutputStream oos) |
void |
setFFIHandle(RubyBasicObject self,
java.lang.Object value)
Set the FFI handle for the given object.
|
void |
setVariableInternal(RubyBasicObject self,
int index,
java.lang.Object value)
Virtual entry point for setting a variable into an object.
|
static void |
setVariableInternal(RubyClass realClass,
RubyBasicObject self,
int index,
java.lang.Object value)
Static entry point for setting a variable in an object.
|
void |
syncVariables(RubyBasicObject self,
IRubyObject other)
Sync one this object's variables with other's - this is used to make
rbClone work correctly.
|
public VariableTableManager(RubyClass realClass)
realClass
- the "real" class associated with this tablepublic java.util.Map<java.lang.String,VariableAccessor> getVariableAccessorsForRead()
public boolean hasObjectID()
public long getObjectId(RubyBasicObject self)
self
- the object from which to get object_idpublic void setVariableInternal(RubyBasicObject self, int index, java.lang.Object value)
self
- the object into which to set the valueindex
- the index allocated for the valuevalue
- the valuepublic static void setVariableInternal(RubyClass realClass, RubyBasicObject self, int index, java.lang.Object value)
realClass
- the "real" class of the objectself
- the object into which to set the variableindex
- the index allocated for the variablevalue
- the value of the variablepublic VariableAccessor getVariableAccessorForWrite(java.lang.String name)
name
- the name of the variablepublic VariableAccessor getVariableAccessorForVar(java.lang.String name, java.lang.invoke.MethodHandle getter, java.lang.invoke.MethodHandle setter)
public VariableAccessor getVariableAccessorForRead(java.lang.String name)
name
- the name of the variablepublic VariableAccessor getObjectIdAccessorForRead()
public VariableAccessor getObjectIdAccessorForWrite()
public VariableAccessor getFFIHandleAccessorForRead()
public VariableAccessor getFFIHandleAccessorForWrite()
public VariableAccessor getObjectGroupAccessorForRead()
public VariableAccessor getObjectGroupAccessorForWrite()
public final java.lang.Object getFFIHandle(RubyBasicObject self)
self
- the objectpublic final void setFFIHandle(RubyBasicObject self, java.lang.Object value)
self
- the objectself
- the object's FFI handlepublic int getVariableTableSize()
public int getVariableTableSizeWithExtras()
public java.util.Map<java.lang.String,VariableAccessor> getVariableTableCopy()
public java.lang.String[] getVariableNames()
public void syncVariables(RubyBasicObject self, IRubyObject other)
self
- the object into which to sync variablesother
- the object from which to sync variablespublic boolean hasVariables(RubyBasicObject object)
public void serializeVariables(RubyBasicObject object, java.io.ObjectOutputStream oos) throws java.io.IOException
java.io.IOException
public void deserializeVariables(RubyBasicObject object, java.io.ObjectInputStream ois) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public java.lang.Object clearVariable(RubyBasicObject object, java.lang.String name)
public VariableAccessorField getObjectIdAccessorField()
getObjectIdAccessorForRead()
or getObjectIdAccessorForWrite()
public VariableAccessorField getFFIHandleAccessorField()
getFFIHandleAccessorForRead()
or getFFIHandleAccessorForWrite()
public VariableAccessorField getObjectGroupAccessorField()
getObjectGroupAccessorForRead()
or getObjectGroupAccessorForWrite()
Copyright © 2001-2020 JRuby. All Rights Reserved.