public class VersionedHolder<T> extends java.lang.Object implements VersionedObject<T>
| Constructor and Description |
|---|
VersionedHolder() |
VersionedHolder(T initialValue) |
| Modifier and Type | Method and Description |
|---|---|
VersionedReference<T> |
createReference()
Creates a new VersionedReference that can be used to monitor
when this object changes.
|
T |
getObject()
Returns the object that is being versioned.
|
long |
getVersion()
Returns the current version of the versioned object.
|
void |
incrementVersion()
Manually increments the version causing VersionedReferences to
see this object as changed.
|
void |
setObject(T value)
Sets a new value to the refenced object and increments the version.
|
boolean |
updateObject(T value)
Sets a new value to the refenced object only if has changed.
|
public VersionedHolder()
public VersionedHolder(T initialValue)
public long getVersion()
VersionedObjectgetVersion in interface VersionedObject<T>public void setObject(T value)
public boolean updateObject(T value)
public void incrementVersion()
public T getObject()
VersionedObjectgetObject in interface VersionedObject<T>public VersionedReference<T> createReference()
VersionedObjectcreateReference in interface VersionedObject<T>