public static final class PersistenceManager.Default<D> extends Object implements PersistenceManager<D>, Unpersistable
PersistenceManager.Default<D>ByteOrderTargeting.Mutable<T extends ByteOrderTargeting.Mutable<?>>| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all ties to outside resources, if applicable.
|
<C extends Consumer<Object>> |
collect(C collector,
long... objectIds) |
void |
consolidate() |
PersistenceStorer |
createEagerStorer()
Creates a new
Storer instance with eager storing behavior. |
PersistenceStorer |
createLazyStorer()
Creates a new
Storer instance with lazy storing behavior. |
PersistenceLoader |
createLoader() |
PersistenceRegisterer |
createRegisterer() |
PersistenceStorer |
createStorer()
Creates a new
Storer instance with default storing behavior. |
PersistenceStorer |
createStorer(PersistenceStorer.Creator<D> storerCreator) |
long |
currentObjectId() |
long |
ensureObjectId(Object object) |
<T> long |
ensureObjectId(T object,
PersistenceObjectIdRequestor<D> objectIdRequestor,
PersistenceTypeHandler<D,T> optionalHandler) |
<T> long |
ensureObjectIdGuaranteedRegister(T object,
PersistenceObjectIdRequestor<D> objectIdRequestor,
PersistenceTypeHandler<D,T> optionalHandler) |
Object |
get() |
Object |
getObject(long objectId) |
ByteOrder |
getTargetByteOrder() |
Object |
lookupObject(long objectId) |
long |
lookupObjectId(Object object) |
void |
mergeEntries(PersistenceLocalObjectIdRegistry<D> localRegistry) |
PersistenceObjectRegistry |
objectRegistry() |
boolean |
registerLocalRegistry(PersistenceLocalObjectIdRegistry<D> localRegistry) |
PersistenceSource<D> |
source() |
long |
store(Object object)
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 to
PersistenceStoring.store(Object) all instances of an Iterable 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 passed Iterable 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 to
PersistenceStoring.store(Object) multiple instances. |
PersistenceTarget<D> |
target() |
PersistenceTypeDictionary |
typeDictionary() |
PersistenceManager.Default<D> |
updateCurrentObjectId(long currentObjectId) |
void |
updateMetadata(PersistenceTypeDictionary typeDictionary,
long highestTypeId,
long highestObjectId) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitNew, updateMetadataClone, NewisByteOrderMismatch, isByteOrderMismatchpublic final ByteOrder getTargetByteOrder()
getTargetByteOrder in interface ByteOrderTargeting<PersistenceManager<D>>public final PersistenceObjectRegistry objectRegistry()
objectRegistry in interface PersistenceManager<D>public final PersistenceTypeDictionary typeDictionary()
typeDictionary in interface PersistenceManager<D>public final void consolidate()
consolidate in interface PersistenceObjectManager<D>public final PersistenceStorer createLazyStorer()
PersisterStorer instance with lazy storing behavior. This means an entity instance encountered
while traversing the entity graph is only stored if it is not yet known to the persistence context, i.e.
does not have an objectId associated with it in the persistence context's PersistenceObjectRegistry.createLazyStorer in interface PersistenceManager<D>createLazyStorer in interface PersisterStorer instance.public final PersistenceStorer createStorer()
PersisterStorer instance with default storing behavior. The default is lazy storing.
See Persister.createLazyStorer().createStorer in interface PersistenceManager<D>createStorer in interface PersisterStorer instance.public final PersistenceStorer createEagerStorer()
PersisterStorer instance with eager storing behavior. This means an entity instance encountered
while traversing the entity graph is always stored, regardless of if it is already known to the persistence
context or not, i.e. does have an objectId associated with it in the persistence context's
PersistenceObjectRegistry.
Note: Eager storing is a dangerous behavior since - depending on the entity graph's referential layout -
it can cause the whole entity graph present in the heap to be stored. Therefore, it is stronly advised to
instead use lazy storing logic (see Persister.createLazyStorer()) or some other kind of limiting storing logic.
createEagerStorer in interface PersistenceManager<D>createEagerStorer in interface PersisterStorer instance.public final PersistenceStorer createStorer(PersistenceStorer.Creator<D> storerCreator)
createStorer in interface PersistenceManager<D>public final PersistenceRegisterer createRegisterer()
createRegisterer in interface PersistenceManager<D>public final long store(Object object)
Persisterstore in interface PersistenceStoringstore in interface Persisterobject - the root instance of the subgraph of required instances to be stored.public final long[] storeAll(Object... instances)
PersisterPersistenceStoring.store(Object) multiple instances.
The passed array (maybe implicitely created by the compiler) itself is NOT stored.storeAll in interface PersistenceStoringstoreAll in interface Persisterinstances - multiple root instances of the subgraphs of required instances to be stored.public void storeAll(Iterable<?> instances)
PersisterPersistenceStoring.store(Object) all instances of an Iterable type, usually a collection.Iterable 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.storeAll in interface PersistenceStoringstoreAll in interface Persisterinstances - multiple root instances of the subgraphs of required instances to be stored.public final long ensureObjectId(Object object)
ensureObjectId in interface PersistenceObjectManager<D>public final <T> long ensureObjectId(T object,
PersistenceObjectIdRequestor<D> objectIdRequestor,
PersistenceTypeHandler<D,T> optionalHandler)
ensureObjectId in interface PersistenceObjectManager<D>public final <T> long ensureObjectIdGuaranteedRegister(T object,
PersistenceObjectIdRequestor<D> objectIdRequestor,
PersistenceTypeHandler<D,T> optionalHandler)
ensureObjectIdGuaranteedRegister in interface PersistenceObjectManager<D>public long currentObjectId()
currentObjectId in interface PersistenceManager<D>currentObjectId in interface PersistenceObjectIdHoldercurrentObjectId in interface PersistenceObjectManager<D>public final long lookupObjectId(Object object)
lookupObjectId in interface PersistenceObjectIdLookuppublic final Object lookupObject(long objectId)
lookupObject in interface PersistenceObjectLookuppublic final boolean registerLocalRegistry(PersistenceLocalObjectIdRegistry<D> localRegistry)
registerLocalRegistry in interface PersistenceObjectManager<D>public final void mergeEntries(PersistenceLocalObjectIdRegistry<D> localRegistry)
mergeEntries in interface PersistenceObjectManager<D>public final Object get()
get in interface PersistenceRetrievingpublic final <C extends Consumer<Object>> C collect(C collector, long... objectIds)
collect in interface PersistenceRetrievingpublic final Object getObject(long objectId)
PersistergetObject in interface PersistenceRetrievinggetObject in interface PersistenceSourceSupplier<D>getObject in interface PersistergetObject in interface one.microstream.reference.ObjectSwizzlingpublic final PersistenceLoader createLoader()
createLoader in interface PersistenceManager<D>public final PersistenceSource<D> source()
source in interface PersistenceManager<D>source in interface PersistenceSourceSupplier<D>public final PersistenceTarget<D> target()
target in interface PersistenceManager<D>public void close()
PersistenceManagerclose in interface PersistenceManager<D>public PersistenceManager.Default<D> updateCurrentObjectId(long currentObjectId)
updateCurrentObjectId in interface PersistenceManager<D>updateCurrentObjectId in interface PersistenceObjectIdHolderupdateCurrentObjectId in interface PersistenceObjectManager<D>public void updateMetadata(PersistenceTypeDictionary typeDictionary, long highestTypeId, long highestObjectId)
updateMetadata in interface PersistenceManager<D>Copyright © 2022 MicroStream Software. All rights reserved.