|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RestorableIO<T>
This interface marks classes that contain methods to create a "backup instance" and to restore later from that instance. Despite its name the original object is not restored, but modifications are made to a copy and in case of success are copied to the original. So the typical usage looks like this:
try{
T copy = original.deepCopy();
// do something to copy
original.copyFrom(copy);
} catch (Exception e){
// original was not modified
}
Method Summary | |
---|---|
void |
copyFrom(T source)
Copies all values from the source object After the copy, this object behaves like the source. |
T |
deepCopy()
Provides a deep copy of this object. |
Methods inherited from interface java.io.Closeable |
---|
close |
Method Detail |
---|
T deepCopy()
void copyFrom(T source) throws IOException
source
- the source instance. Compatibility depends on the
implementing class. In the standard case it should be the result of a
prior call to deepCopy()
.
IOException
- if an I/O error occurs
ClassCastException
- if the source was not previously copied
from this instance.
IllegalStateException
- if the source was not previously copied
from this instance.
NullPointerException
- if the source is null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |