Package com.oracle.coherence.repository
Class AbstractRepositoryBase<ID,T,M>
java.lang.Object
com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,M>
- Type Parameters:
ID- the type of entity's identifierT- the type of entity stored in this repositoryM- the underlying map type
- Direct Known Subclasses:
AbstractAsyncRepository,AbstractRepository
Base functionality for all Coherence
repository
implementations.
- Since:
- 21.06
- Author:
- Ryan Lubke 2021.04.08, Aleks Seovic
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface that should be implemented by the clients interested in repository events.protected static classAdapter fromAbstractRepositoryBase.ListenertoMapListenerthat can be registered with the backingNamedMap. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(AbstractRepositoryBase.Listener<? super T> listener) Register a listener that will observe all repository events.voidaddListener(Filter<?> filter, AbstractRepositoryBase.Listener<? super T> listener) Register a listener that will observe all events for entities that satisfy the specified criteria.voidaddListener(ID id, AbstractRepositoryBase.Listener<? super T> listener) Register a listener that will observe all events for a specific entity.protected voidCreates indices for this repository that are defined via@Acceleratedand@Indexedannotations.protected voidEnsures that this repository is initialized by creating necessary indices on the backing map.Return the type of entities in this repository.protected abstract IDReturn the identifier of the specified entity instance.protected abstract MgetMap()Return the map that is used as the underlying entity store.protected MapListener<? super ID,? super T> instantiateMapListener(AbstractRepositoryBase.Listener<? super T> delegate) Factory method forAbstractRepositoryBase.Listeneradapter toMapListener.listener()Create newAbstractRepositoryBase.Listener.Builderinstance.voidremoveListener(AbstractRepositoryBase.Listener<? super T> listener) Unregister a listener that observes all repository events.voidremoveListener(Filter<?> filter, AbstractRepositoryBase.Listener<? super T> listener) Unregister a listener that observes all events for entities that satisfy the specified criteria.voidremoveListener(ID id, AbstractRepositoryBase.Listener<? super T> listener) Unregister a listener that observes all events for a specific entity.
-
Constructor Details
-
AbstractRepositoryBase
public AbstractRepositoryBase()
-
-
Method Details
-
getId
Return the identifier of the specified entity instance.- Parameters:
entity- the entity to get the identifier from- Returns:
- the identifier of the specified entity instance
-
getEntityType
Return the type of entities in this repository.- Returns:
- the type of entities in this repository
-
getMap
Return the map that is used as the underlying entity store.- Returns:
- the map that is used as the underlying entity store
-
ensureInitialized
protected void ensureInitialized()Ensures that this repository is initialized by creating necessary indices on the backing map. Base framework classes that extend this class should call this method after the backing map has been initialized, but before any other calls are made. -
createIndices
protected void createIndices()Creates indices for this repository that are defined via@Acceleratedand@Indexedannotations. If overriding this method, please callsuper.createIndices()or the standard behavior will not work. -
instantiateMapListener
protected MapListener<? super ID,? super T> instantiateMapListener(AbstractRepositoryBase.Listener<? super T> delegate) Factory method forAbstractRepositoryBase.Listeneradapter toMapListener.- Parameters:
delegate- theAbstractRepositoryBase.Listenerto delegate events to- Returns:
- a
MapListenerthat can be registered with aNamedMapand will delegate events to theAbstractRepositoryBase.Listenerit wraps
-
addListener
Register a listener that will observe all repository events.- Parameters:
listener- the event listener to register
-
removeListener
Unregister a listener that observes all repository events.- Parameters:
listener- the event listener to unregister
-
addListener
Register a listener that will observe all events for a specific entity.- Parameters:
id- the identifier of the entity to observelistener- the event listener to register
-
removeListener
Unregister a listener that observes all events for a specific entity.- Parameters:
id- the identifier of the entity to observelistener- the event listener to unregister
-
addListener
Register a listener that will observe all events for entities that satisfy the specified criteria.- Parameters:
filter- the criteria to use to select entities to observelistener- the event listener to register
-
removeListener
Unregister a listener that observes all events for entities that satisfy the specified criteria.- Parameters:
filter- the criteria to use to select entities to observelistener- the event listener to unregister
-
listener
Create newAbstractRepositoryBase.Listener.Builderinstance.- Returns:
- a new
AbstractRepositoryBase.Listener.Builderinstance
-