public class VolatileField extends Object
| Constructor and Description |
|---|
VolatileField(FieldAccessor accessor,
Object container)
Initializes a volatile field with the given accessor and associated object.
|
VolatileField(Field field,
Object container)
Initializes a volatile field with an associated object.
|
VolatileField(Field field,
Object container,
boolean forceAccess)
Initializes a volatile field with an associated object.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
finalize() |
Object |
getContainer()
Retrieves the object the field is stored.
|
Field |
getField()
Retrieves the current field.
|
Object |
getOldValue()
Retrieves the field value before the previous setValue(), unless saveValue() has been called.
|
Object |
getValue()
Retrieves the current field value.
|
boolean |
isCurrentSet()
Determine whether or not we'll need to revert the value.
|
boolean |
isForceAccess()
Retrieves whether or not not to override any scope restrictions.
|
void |
refreshValue()
Reapply the current changed value.
|
void |
revertValue()
Revert to the previously set value.
|
void |
saveValue()
Ensure that the current value is still set after this class has been garbaged collected.
|
void |
setForceAccess(boolean forceAccess)
Sets whether or not not to override any scope restrictions.
|
void |
setValue(Object newValue)
Sets the current value.
|
String |
toString() |
VolatileField |
toSynchronized()
Retrieve a synchronized version of the current field.
|
public VolatileField(Field field, Object container)
field - - the field.container - - the object this field belongs to.public VolatileField(Field field, Object container, boolean forceAccess)
field - - the field.container - - the object this field belongs to.forceAccess - - whether or not to override any scope restrictions.public VolatileField(FieldAccessor accessor, Object container)
accessor - - the field accessor.container - - the object this field belongs to.public Field getField()
public Object getContainer()
public boolean isForceAccess()
public void setForceAccess(boolean forceAccess)
forceAccess - - TRUE if we override scope, FALSE otherwise.public Object getValue()
public Object getOldValue()
public void setValue(Object newValue)
newValue - - new field value.public void refreshValue()
Also refresh the previously set value.
public void saveValue()
public void revertValue()
public VolatileField toSynchronized()
public boolean isCurrentSet()
protected void finalize()
throws Throwable
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.