public abstract class LazyUndoable extends java.lang.Object implements Undoable
Modifier and Type | Field and Description |
---|---|
private boolean |
changed
Flag indicating if this instance was changed.
|
private boolean |
global
Flag indicating if this resource was defined as a NEW GLOBAL SHARED.
|
private boolean |
rollingBack
Flag indicating if this instance is currently rolling back.
|
private int |
transLevel
This is the transaction nesting level, where the undoable was last changed.
|
private boolean |
undoable
Flag indicating if this instance is undoable.
|
private TransactionManager.UndoableHelper |
undoableHelper
Helper object to access context-local data in the
TransactionManager . |
Constructor and Description |
---|
LazyUndoable() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
changed()
Check if this variable has changed.
|
protected void |
checkUndoable(boolean changed)
Check if this undoable has changed; if so, and we are in a transaction block (and not
rolling back ), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level . |
protected void |
checkUndoable(java.util.function.Supplier<Undoable> newValue)
Check if this undoable has changed; if so, and we are in a transaction block (and not
rolling back ), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level . |
protected void |
checkUndoable(Undoable newValue)
Check if this undoable has changed; if so, and we are in a transaction block (and not
rolling back ), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level . |
private void |
checkUndoable(Undoable nv1,
java.util.function.Supplier<Undoable> nv2,
boolean force)
Check if this undoable has changed; if so, and we are in a transaction block (and not
rolling back ), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level . |
(package private) int |
getTransLevel()
Get the transaction level at which this instance was last registered.
|
protected boolean |
isGlobal()
Get this undoable's global state.
|
protected boolean |
isUndoable()
Check if this instance is undoable.
|
protected void |
markUndoable(int transLevel)
Mark this instance as undoable and save the transaction level where it was created.
|
protected void |
popBlock()
Notification that a transaction block was finished.
|
protected void |
rollback(Undoable copy)
Rollback this instance to the state in the given copy.
|
protected void |
setGlobal(boolean global)
Set this undoable as defined via a NEW GLOBAL SHARED statement.
|
private transient boolean undoable
private transient boolean changed
private transient boolean rollingBack
private transient boolean global
private transient int transLevel
private transient TransactionManager.UndoableHelper undoableHelper
TransactionManager
.protected final void setGlobal(boolean global)
global
- true
to indicate a global resource.protected final boolean isGlobal()
global
flag.protected final void popBlock()
protected final boolean changed()
changed
flag.changed
flag.protected final void rollback(Undoable copy)
copy
- The state to which the instance is rolledback.protected boolean isUndoable()
undoable
flag state.protected final void markUndoable(int transLevel)
transLevel
- The transaction nesting level where this instance was created.protected void checkUndoable(boolean changed)
rolling back
), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level
.changed
- Flag indicating if this undoable has changed or not.protected void checkUndoable(Undoable newValue)
rolling back
), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level
.newValue
- To value to compare against, when deciding if this undoable is changed.protected void checkUndoable(java.util.function.Supplier<Undoable> newValue)
rolling back
), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level
.newValue
- To value to compare against, when deciding if this undoable is changed.int getTransLevel()
transLevel
.private void checkUndoable(Undoable nv1, java.util.function.Supplier<Undoable> nv2, boolean force)
rolling back
), then register this instance with all blocks up the stack,
which were started after the object's last save transaction level
.
If the changed
argument is true
, then the nv1
and
nv2
arguments are ignored; otherwise, if nv2
is not-null, then
this will be used to compare against, while nv1
is used in the last case.
nv1
- To value to compare against, when deciding if this undoable is changed.nv2
- To value to compare against, when deciding if this undoable is changed, wrapped
in a supplier, to avoid instantiating a new object.force
- When true
, ignore the previous two arguments and force the undoable
registration.