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

public final Class VariableAccessorField

extends Object
Class Inheritance

A lazy mechanism for accessing VariableAccessors for a given variable name.

Field Summary

Modifier and TypeField and Description
private final String
name

the name of the variable

private volatile VariableAccessor
variableAccessor

the accessor cached after it has been allocated

Constructor Summary

AccessConstructor and Description
public
VariableAccessorField(String
the name of the variable
name
)

Construct a new VariableAccessorField for the given named variable.

Method Summary

Modifier and TypeMethod and Description
private synchronized VariableAccessor

Returns:

the variable accessor appropriate for writes
allocateVariableAccessor
(VariableTableManager
the VariableTableManager for which to allocate an accessor, if it has not already been allocated.
tableMgr
)

Retrieve or allocate the variable accessor for this variable.

public VariableAccessor

Returns:

the variable accessor appropriate for reads
getVariableAccessorForRead
()

Retrieve the variable accessor for read.

public VariableAccessor

Returns:

the variable accessor appropriate for writes.
getVariableAccessorForWrite
(VariableTableManager
the VariableTableManager for which to allocate an accessor, if it has not already been allocated.
tableMgr
)

Retrieve the variable access for write.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private final String name

the name of the variable

variableAccessorback to summary
private volatile VariableAccessor variableAccessor

the accessor cached after it has been allocated

Constructor Detail

VariableAccessorFieldback to summary
public VariableAccessorField(String name)

Construct a new VariableAccessorField for the given named variable.

Parameters
name:String

the name of the variable

Method Detail

allocateVariableAccessorback to summary
private synchronized VariableAccessor allocateVariableAccessor(VariableTableManager tableMgr)

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:VariableTableManager

the VariableTableManager for which to allocate an accessor, if it has not already been allocated.

Returns:VariableAccessor

the variable accessor appropriate for writes

getVariableAccessorForReadback to summary
public VariableAccessor getVariableAccessorForRead()

Retrieve the variable accessor for read.

Returns:VariableAccessor

the variable accessor appropriate for reads

getVariableAccessorForWriteback to summary
public VariableAccessor getVariableAccessorForWrite(VariableTableManager tableMgr)

Retrieve the variable access for write.

Parameters
tableMgr:VariableTableManager

the VariableTableManager for which to allocate an accessor, if it has not already been allocated.

Returns:VariableAccessor

the variable accessor appropriate for writes.