Class AbstractRepositoryBase<ID,T,M>

java.lang.Object
com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,M>
Type Parameters:
ID - the type of entity's identifier
T - the type of entity stored in this repository
M - the underlying map type
Direct Known Subclasses:
AbstractAsyncRepository, AbstractRepository

public abstract class AbstractRepositoryBase<ID,T,M> extends Object
Base functionality for all Coherence repository implementations.
Since:
21.06
Author:
Ryan Lubke 2021.04.08, Aleks Seovic
  • Constructor Details

    • AbstractRepositoryBase

      public AbstractRepositoryBase()
  • Method Details

    • getId

      protected abstract ID getId(T entity)
      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

      protected abstract Class<? extends T> getEntityType()
      Return the type of entities in this repository.
      Returns:
      the type of entities in this repository
    • getMap

      protected abstract M 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 @Accelerated and @Indexed annotations.

      If overriding this method, please call super.createIndices() or the standard behavior will not work.

    • instantiateMapListener

      protected MapListener<? super ID,? super T> instantiateMapListener(AbstractRepositoryBase.Listener<? super T> delegate)
      Factory method for AbstractRepositoryBase.Listener adapter to MapListener.
      Parameters:
      delegate - the AbstractRepositoryBase.Listener to delegate events to
      Returns:
      a MapListener that can be registered with a NamedMap and will delegate events to the AbstractRepositoryBase.Listener it wraps
    • addListener

      public void addListener(AbstractRepositoryBase.Listener<? super T> listener)
      Register a listener that will observe all repository events.
      Parameters:
      listener - the event listener to register
    • removeListener

      public void removeListener(AbstractRepositoryBase.Listener<? super T> listener)
      Unregister a listener that observes all repository events.
      Parameters:
      listener - the event listener to unregister
    • addListener

      public void addListener(ID id, AbstractRepositoryBase.Listener<? super T> listener)
      Register a listener that will observe all events for a specific entity.
      Parameters:
      id - the identifier of the entity to observe
      listener - the event listener to register
    • removeListener

      public void removeListener(ID id, AbstractRepositoryBase.Listener<? super T> listener)
      Unregister a listener that observes all events for a specific entity.
      Parameters:
      id - the identifier of the entity to observe
      listener - the event listener to unregister
    • addListener

      public void addListener(Filter<?> filter, AbstractRepositoryBase.Listener<? super T> listener)
      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 observe
      listener - the event listener to register
    • removeListener

      public void removeListener(Filter<?> filter, AbstractRepositoryBase.Listener<? super T> listener)
      Unregister a listener that observes all events for entities that satisfy the specified criteria.
      Parameters:
      filter - the criteria to use to select entities to observe
      listener - the event listener to unregister
    • listener

      Returns:
      a new AbstractRepositoryBase.Listener.Builder instance