Class AbstractCoherenceAsyncRepository<T,ID>

java.lang.Object
com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
com.oracle.coherence.repository.AbstractAsyncRepository<ID,T>
io.micronaut.coherence.data.AbstractCoherenceAsyncRepository<T,ID>
Type Parameters:
ID - the ID type
T - the entity type
All Implemented Interfaces:
io.micronaut.data.repository.GenericRepository<T,ID>

public abstract class AbstractCoherenceAsyncRepository<T,ID> extends com.oracle.coherence.repository.AbstractAsyncRepository<ID,T> implements io.micronaut.data.repository.GenericRepository<T,ID>
While it's possible to annotate a simple AsyncCrudRepository with CoherenceRepository and use Coherence as a backend cache. However, to take full advantage of the feature set Coherence has to offer, it is recommended extending this class. This will give you all the features as documented in AbstractAsyncRepository.

Any class extending this class must be declared abstract and cannot implement any of the Micronaut repository types due to overlap in methods between those interface methods and those provided by AbstractAsyncRepository.

  • Nested Class Summary

    Nested classes/interfaces inherited from class com.oracle.coherence.repository.AbstractRepositoryBase

    com.oracle.coherence.repository.AbstractRepositoryBase.Listener<T extends Object>, com.oracle.coherence.repository.AbstractRepositoryBase.MapListenerAdapter<ID extends Object,T extends Object>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Class<? extends T>
     
    protected abstract Class<? extends T>
    This is in place to prevent Micronaut from scanning further up the inheritance tree and trying to map AbstractRepositoryBase.getEntityType() and failing.
    protected ID
    getId(T t)
     
    protected abstract ID
    getIdInternal(T entity)
    This is in place to prevent Micronaut from scanning further up the inheritance tree and trying to map AbstractRepositoryBase.getId(Object) and failing.
    protected com.tangosol.net.AsyncNamedMap<ID,T>
     
    protected abstract com.tangosol.net.AsyncNamedMap<ID,T>
    This is in place to prevent Micronaut from scanning further up the inheritance tree and trying to map AbstractRepositoryBase.getMap() and failing.
    remove(T entity)
     
    save(T entity)
     

    Methods inherited from class com.oracle.coherence.repository.AbstractAsyncRepository

    average, average, average, average, average, average, average, average, count, count, distinct, distinct, exists, get, get, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAll, getAllOrderedBy, getAllOrderedBy, getAllOrderedBy, getAllOrderedBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, groupBy, max, max, max, max, max, max, max, max, max, max, maxBy, maxBy, min, min, min, min, min, min, min, min, min, min, minBy, minBy, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeAll, removeAllById, removeAllById, removeById, removeById, saveAll, saveAll, sum, sum, sum, sum, sum, sum, sum, sum, top, top, top, top, topBy, topBy, topBy, topBy, update, update, update, update, update, update, updateAll, updateAll, updateAll

    Methods inherited from class com.oracle.coherence.repository.AbstractRepositoryBase

    addListener, addListener, addListener, createIndices, ensureInitialized, instantiateMapListener, listener, removeListener, removeListener, removeListener

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractCoherenceAsyncRepository

      public AbstractCoherenceAsyncRepository()
  • Method Details

    • getMap

      protected com.tangosol.net.AsyncNamedMap<ID,T> getMap()
      Specified by:
      getMap in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
    • getId

      protected ID getId(T t)
      Specified by:
      getId in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
    • getEntityType

      protected Class<? extends T> getEntityType()
      Specified by:
      getEntityType in class com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,com.tangosol.net.AsyncNamedMap<ID,T>>
    • save

      public CompletableFuture<T> save(T entity)
      Overrides:
      save in class com.oracle.coherence.repository.AbstractAsyncRepository<ID,T>
    • remove

      public CompletableFuture<Boolean> remove(T entity)
      Overrides:
      remove in class com.oracle.coherence.repository.AbstractAsyncRepository<ID,T>
    • getIdInternal

      protected abstract ID getIdInternal(T entity)
      This is in place to prevent Micronaut from scanning further up the inheritance tree and trying to map AbstractRepositoryBase.getId(Object) and failing.

      Called only by getId(Object).

      Parameters:
      entity - the entity
      Returns:
      the ID of the provided entity
    • getMapInternal

      protected abstract com.tangosol.net.AsyncNamedMap<ID,T> getMapInternal()
      This is in place to prevent Micronaut from scanning further up the inheritance tree and trying to map AbstractRepositoryBase.getMap() and failing.

      Called only by getId(Object).

      Returns:
      the AsyncNamedMap for this repository
    • getEntityTypeInternal

      protected abstract Class<? extends T> getEntityTypeInternal(T entity)
      This is in place to prevent Micronaut from scanning further up the inheritance tree and trying to map AbstractRepositoryBase.getEntityType() and failing.

      Note: the value passed to this may always be null. We don't care about the value as due to how the Coherence API is defined, there can never be a value. However, we can rely on compile type information generated by Micronaut for this intercepted method and use that metadata to return the entity type.

      Called only by getEntityType().

      Parameters:
      entity - the entity
      Returns:
      the Class representing the entity type handled by this repository.