Interface Persister
-
- All Superinterfaces:
ObjectSwizzling
,PersistenceStoring
- All Known Subinterfaces:
EmbeddedStorageManager
,PersistenceManager<D>
,StorageConnection
,StorageManager
- All Known Implementing Classes:
EmbeddedStorageManager.Default
,PersistenceManager.Default
,StorageConnection.Default
public interface Persister extends ObjectSwizzling, PersistenceStoring
-
-
Method Summary
Modifier and Type Method Description Storer
createEagerStorer()
Storer
createLazyStorer()
Storer
createStorer()
Object
getObject(long objectId)
long
store(Object instance)
Stores the passed instance in any case and all referenced instances of persistable references recursively, but stores referenced instances only if they are newly encountered (e.g.void
storeAll(Iterable<?> instances)
Convenience method toPersistenceStoring.store(Object)
all instances of anIterable
type, usually a collection.
The passed instance itself is NOT stored.
Note that this method does not return an array of objectIds, since the amount of instances supplied by the passedIterable
cannot be known until after all instances have been stored and the memory and performance overhead to collect them dynamically would not be worth it in most cases since the returned array is hardly ever needed.long[]
storeAll(Object... instances)
Convenience method toPersistenceStoring.store(Object)
multiple instances.
-
-
-
Method Detail
-
getObject
Object getObject(long objectId)
- Specified by:
getObject
in interfaceObjectSwizzling
-
store
long store(Object instance)
Description copied from interface:PersistenceStoring
Stores the passed instance in any case and all referenced instances of persistable references recursively, but stores referenced instances only if they are newly encountered (e.g. don't have an id associated with them in the object registry, yet and are therefore required to be handled). This is useful for the common case of just storing an updated instance and potentially newly created instances along with it while skipping all existing (and normally unchanged) referenced instances.- Specified by:
store
in interfacePersistenceStoring
- Parameters:
instance
- the root instance of the subgraph of required instances to be stored.- Returns:
- the object id representing the passed instance.
-
storeAll
long[] storeAll(Object... instances)
Description copied from interface:PersistenceStoring
Convenience method toPersistenceStoring.store(Object)
multiple instances. The passed array (maybe implicitely created by the compiler) itself is NOT stored.- Specified by:
storeAll
in interfacePersistenceStoring
- Parameters:
instances
- multiple root instances of the subgraphs of required instances to be stored.- Returns:
- an array containing the object ids representing the passed instances.
-
storeAll
void storeAll(Iterable<?> instances)
Description copied from interface:PersistenceStoring
Convenience method toPersistenceStoring.store(Object)
all instances of anIterable
type, usually a collection.
The passed instance itself is NOT stored.
Note that this method does not return an array of objectIds, since the amount of instances supplied by the passedIterable
cannot be known until after all instances have been stored and the memory and performance overhead to collect them dynamically would not be worth it in most cases since the returned array is hardly ever needed. If it should be needed, the desired behavior can be easily achieved with a tiny custom-made utility method.- Specified by:
storeAll
in interfacePersistenceStoring
- Parameters:
instances
- multiple root instances of the subgraphs of required instances to be stored.
-
createLazyStorer
Storer createLazyStorer()
-
createStorer
Storer createStorer()
-
createEagerStorer
Storer createEagerStorer()
-
-