Interface Restorable<T extends Restorable<T>>

  • Type Parameters:
    T - the restorable object's type
    All Known Subinterfaces:
    ReadChannel, WriteChannel
    All Known Implementing Classes:
    BaseWriteChannel

    public interface Restorable<T extends Restorable<T>>
    Implementation of this interface can persist their state and restore from it.

    A typical capture usage:

    
     X restorableObj; // X instanceof Restorable<X>
     RestorableState<X> state = restorableObj.capture();
     .. persist state
     

    A typical restore usage:

    
     RestorableState<X> state = ... // read from persistence
     X restorableObj = state.restore();
     ...
     
    • Method Detail

      • capture

        RestorableState<T> capture()
        Captures the state of this object.
        Returns:
        a RestorableState instance that contains the state for this object and can restore it afterwards.