Class SimpleGemfireRepository<T,ID>

java.lang.Object
org.springframework.data.gemfire.repository.support.SimpleGemfireRepository<T,ID>
All Implemented Interfaces:
GemfireRepository<T,ID>, org.springframework.data.repository.CrudRepository<T,ID>, org.springframework.data.repository.PagingAndSortingRepository<T,ID>, org.springframework.data.repository.Repository<T,ID>

public class SimpleGemfireRepository<T,ID> extends Object implements GemfireRepository<T,ID>
Simple, basic PagingAndSortingRepository / CrudRepository implementation for Apache Geode.
See Also:
  • Field Details

  • Constructor Details

    • SimpleGemfireRepository

      public SimpleGemfireRepository(@NonNull GemfireTemplate template, @NonNull org.springframework.data.repository.core.EntityInformation<T,ID> entityInformation)
      Constructs a new instance of SimpleGemfireRepository initialized with the GemfireTemplate and EntityInformation.
      Parameters:
      template - GemfireTemplate used to perform basic data access operations and simple OQL queries; must not be null.
      entityInformation - EntityInformation that describes the entity; must not be null.
      Throws:
      IllegalArgumentException - if GemfireTemplate or EntityInformation is null.
      See Also:
  • Method Details

    • getEntityInformation

      @NonNull public org.springframework.data.repository.core.EntityInformation<T,ID> getEntityInformation()
      Returns a reference to the EntityInformation type describing the entity.
      Returns:
      a reference to the EntityInformation type describing the entity.
      See Also:
      • EntityInformation
    • getLogger

      @NonNull public org.slf4j.Logger getLogger()
      Returns a reference to the SLF4J Logger used to log the operations of this GemfireRepository.
      Returns:
      a reference to the SLF4J Logger used to log the operations of this GemfireRepository.
      See Also:
      • Logger
    • getRegion

      @NonNull public org.apache.geode.cache.Region<ID,T> getRegion()
      Gets the Region to which this GemfireRepository performs all data access operations.
      Returns:
      a reference to the Region on which this GemfireRepository operates.
      See Also:
    • getTemplate

      @NonNull public GemfireTemplate getTemplate()
      Returns a reference to the GemfireTemplate used by this GemfireRepository to perform basic CRUD and simple OQL queries data access operations
      Returns:
      a reference to the GemfireTemplate used by this GemfireRepository.
      See Also:
    • save

      public <U extends T> U save(@NonNull U entity)
      Specified by:
      save in interface org.springframework.data.repository.CrudRepository<T,ID>
    • save

      public T save(@NonNull Wrapper<T,ID> wrapper)
      Description copied from interface: GemfireRepository
      Save the entity wrapped by the given Wrapper.
      Specified by:
      save in interface GemfireRepository<T,ID>
      Parameters:
      wrapper - Wrapper object wrapping the entity and the identifier of the entity (i.e. key).
      Returns:
      the saved entity.
      See Also:
    • saveAll

      public <U extends T> Iterable<U> saveAll(@NonNull Iterable<U> entities)
      Specified by:
      saveAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • count

      public long count()
      Counts the number of entities stored in the Region. This method executes a SELECT count(*) FROM /Region OQL query.
      Specified by:
      count in interface org.springframework.data.repository.CrudRepository<T,ID>
      Returns:
      a count of the number of entities stored in the Region.
    • existsById

      public boolean existsById(ID id)
      Determines whether an entity with the given ID is stored in the Region.
      Specified by:
      existsById in interface org.springframework.data.repository.CrudRepository<T,ID>
      Parameters:
      id - Long value identifying the entity.
      Returns:
      a boolean value indicating whether an entity with the given ID is stored in the Region.
      See Also:
    • findAll

      @NonNull public Iterable<T> findAll()
      Specified by:
      findAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findAll

      public org.springframework.data.domain.Page<T> findAll(@NonNull org.springframework.data.domain.Pageable pageable)
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID>
    • findAll

      @NonNull public Iterable<T> findAll(@NonNull org.springframework.data.domain.Sort sort)
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID>
    • findAllById

      @NonNull public Iterable<T> findAllById(@NonNull Iterable<ID> ids)
      Specified by:
      findAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findById

      public Optional<T> findById(@NonNull ID id)
      Specified by:
      findById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • delete

      public void delete(@NonNull T entity)
      Specified by:
      delete in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAll

      public void deleteAll(@NonNull Iterable<? extends T> entities)
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAllById

      public void deleteAllById(@NonNull Iterable<? extends ID> ids)
      Specified by:
      deleteAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteById

      public void deleteById(@NonNull ID id)
      Specified by:
      deleteById in interface org.springframework.data.repository.CrudRepository<T,ID>