Top Description Fields Constructors Methods
org.jruby.runtime.ivars

public Class FieldVariableAccessor

extends VariableAccessor
Class Inheritance
Known Direct Subclasses
org.jruby.runtime.ivars.RawFieldVariableAccessor
Imports
com.headius.invokebinder.Binder, org.jruby.RubyBasicObject, .RubyClass, org.jruby.ir.operands.UndefinedValue, org.jruby.runtime.Helpers, .ThreadContext, org.jruby.runtime.builtin.IRubyObject, org.jruby.specialized.RubyObjectSpecializer, java.lang.invoke.MethodHandle, .MethodHandles

A variable accessor that accesses a field directly;

Field Summary

Modifier and TypeField and Description
private static final MethodHandle
private final MethodHandle
private final MethodHandle
Inherited from org.jruby.runtime.ivars.VariableAccessor:
classIdDUMMY_ACCESSORindexnamerealClassSTAMP_HANDLEVAR_TABLE_HANDLE

Constructor Summary

AccessConstructor and Description
public
FieldVariableAccessor(RubyClass
the "real" class
realClass
,
String
the variable's name
name
,
int
the variable's index
index
,
int
the class's ID
classId
,
MethodHandle
the getter handle for the field
getter
,
MethodHandle
the setter handle for the field
setter
)

Construct a new FieldVariableAccessor for the given "real" class, variable name, variable index, class ID, and field offset

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the variable's value
get
(Object
the object from which to retrieve this variable
object
)

Overrides org.jruby.runtime.ivars.VariableAccessor.get.

Retrieve the variable's value from the given object.

public MethodHandle
public IRubyObject

Returns:

the variable's value
getOrNil
(Object
the object from which to retrieve this variable
object
,
ThreadContext context)

Overrides org.jruby.runtime.ivars.VariableAccessor.getOrNil.

Retrieve the variable's value from the given object.

public MethodHandle
public void
set(Object
the object into which to set this variable
object
,
Object
the variable's value
value
)

Overrides org.jruby.runtime.ivars.VariableAccessor.set.

Set this variable into the given object using Unsafe to ensure safe updating of the variable table.

protected MethodHandle
Inherited from org.jruby.runtime.ivars.VariableAccessor:
getClassIdgetIndexgetNamegetOrUndefinedgetVariabletoStringverify

Field Detail

ENSURE_SETTABLEback to summary
private static final MethodHandle ENSURE_SETTABLE
getterback to summary
private final MethodHandle getter
setterback to summary
private final MethodHandle setter

Constructor Detail

FieldVariableAccessorback to summary
public FieldVariableAccessor(RubyClass realClass, String name, int index, int classId, MethodHandle getter, MethodHandle setter)

Construct a new FieldVariableAccessor for the given "real" class, variable name, variable index, class ID, and field offset

Parameters
realClass:RubyClass

the "real" class

name:String

the variable's name

index:int

the variable's index

classId:int

the class's ID

getter:MethodHandle

the getter handle for the field

setter:MethodHandle

the setter handle for the field

Method Detail

getback to summary
public Object get(Object object)

Overrides org.jruby.runtime.ivars.VariableAccessor.get.

Retrieve the variable's value from the given object.

Parameters
object:Object

the object from which to retrieve this variable

Returns:Object

the variable's value

getGetterback to summary
public MethodHandle getGetter()
getOrNilback to summary
public IRubyObject getOrNil(Object object, ThreadContext context)

Overrides org.jruby.runtime.ivars.VariableAccessor.getOrNil.

Retrieve the variable's value from the given object.

Parameters
object:Object

the object from which to retrieve this variable

Returns:IRubyObject

the variable's value

getSetterback to summary
public MethodHandle getSetter()
setback to summary
public void set(Object object, Object value)

Overrides org.jruby.runtime.ivars.VariableAccessor.set.

Set this variable into the given object using Unsafe to ensure safe updating of the variable table.

Parameters
object:Object

the object into which to set this variable

value:Object

the variable's value

wrapSetterback to summary
protected MethodHandle wrapSetter(MethodHandle setter)