Package org.jruby.runtime.ivars
Class VariableAccessorField
java.lang.Object
org.jruby.runtime.ivars.VariableAccessorField
A lazy mechanism for accessing VariableAccessors for a given variable name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringthe name of the variableprivate VariableAccessorthe accessor cached after it has been allocated -
Constructor Summary
ConstructorsConstructorDescriptionVariableAccessorField(String name) Construct a new VariableAccessorField for the given named variable. -
Method Summary
Modifier and TypeMethodDescriptionprivate VariableAccessorallocateVariableAccessor(VariableTableManager tableMgr) Retrieve or allocate the variable accessor for this variable.Retrieve the variable accessor for read.Retrieve the variable access for write.
-
Field Details
-
name
the name of the variable -
variableAccessor
the accessor cached after it has been allocated
-
-
Constructor Details
-
VariableAccessorField
Construct a new VariableAccessorField for the given named variable.- Parameters:
name- the name of the variable
-
-
Method Details
-
getVariableAccessorForRead
Retrieve the variable accessor for read.- Returns:
- the variable accessor appropriate for reads
-
getVariableAccessorForWrite
Retrieve the variable access for write.- Parameters:
tableMgr- the VariableTableManager for which to allocate an accessor, if it has not already been allocated.- Returns:
- the variable accessor appropriate for writes.
-
allocateVariableAccessor
Retrieve or allocate the variable accessor for this variable. This version differs from getVariableAccessorForWrite only in its visibility and the fact that it is synchronized against this field to ensure volatile behavior of the variableAccessor field.- Parameters:
tableMgr- the VariableTableManager for which to allocate an accessor, if it has not already been allocated.- Returns:
- the variable accessor appropriate for writes
-