Package org.refcodes.command
Class AbstractUndoable<CTX,RET,E extends java.lang.Exception>
- java.lang.Object
-
- org.refcodes.command.AbstractCommand<CTX,RET,E>
-
- org.refcodes.command.AbstractUndoable<CTX,RET,E>
-
- Type Parameters:
CTX
- The context type to use, can by anyComponent
, service or POJO.RET
- The return type of theUndoable
's proceedings.E
- the element type
public abstract class AbstractUndoable<CTX,RET,E extends java.lang.Exception> extends AbstractCommand<CTX,RET,E> implements Undoable<CTX,RET,E>
TheAbstractUndoable
implements theUndoable
interface.
-
-
Constructor Summary
Constructors Constructor Description AbstractUndoable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isUndoable(CTX aContext)
This method determines whether theUndoable
can undo the work it has done.void
undo(CTX aContext)
This method tries to undo theUndoable
in case it was successfully executed.
-
-
-
Method Detail
-
isUndoable
public boolean isUndoable(CTX aContext)
This method determines whether theUndoable
can undo the work it has done.
-
undo
public void undo(CTX aContext) throws NotUndoableRuntimeException, java.lang.UnsupportedOperationException
This method tries to undo theUndoable
in case it was successfully executed. Test viaUndoable.isUndoable(Object)
beforehand to see whether a call toUndoable.undo(Object)
can be applied.- Specified by:
undo
in interfaceUndoable<CTX,RET,E extends java.lang.Exception>
- Parameters:
aContext
- The target object which is used by theUndoable
to do itsUndoable
.- Throws:
NotUndoableRuntimeException
- Thrown in case the performed operation cannot be undone, or no operation as been done before by thisUndoable
.java.lang.UnsupportedOperationException
- Thrown in case theUndoable
does not provide undo facilities.
-
-