T
- the type of object serialized into the filepublic class MemoryBackedObject<T extends Serializable> extends Object implements PersistenceBackedObject<T>
NOTE: Use this class with care as it does not provide a fresh deserialized copy of the data provided,
Constructor and Description |
---|
MemoryBackedObject(Class<T> clazz) |
Modifier and Type | Method and Description |
---|---|
boolean |
exists()
Returns whether the intended persistence location is already populated.
|
String |
getPath()
Returns the path to the intended persistence location.
|
T |
newInstance(TreeLogger logger)
Constructs and returns a new instance of the object stored at the path.
|
void |
set(TreeLogger logger,
T object)
Serializes the provided object to the intended path.
|
String |
toString() |
public boolean exists()
PersistenceBackedObject
exists
in interface PersistenceBackedObject<T extends Serializable>
public String getPath()
PersistenceBackedObject
getPath
in interface PersistenceBackedObject<T extends Serializable>
public T newInstance(TreeLogger logger) throws UnableToCompleteException
PersistenceBackedObject
newInstance
in interface PersistenceBackedObject<T extends Serializable>
UnableToCompleteException
- if the backing store does not contain an object of type
T
public void set(TreeLogger logger, T object) throws IllegalStateException, UnableToCompleteException
PersistenceBackedObject
set
in interface PersistenceBackedObject<T extends Serializable>
UnableToCompleteException
- if the object could not be serializedIllegalStateException
Copyright © 2018. All rights reserved.