Interface Repository<T,​ID>

Type Parameters:
T - type of entity
ID - type of entity id
All Known Implementing Classes:
AbstractRepository, AlbumRepository, GeoLocatioRepository, ImageRepository, LoginRepository, MetadataRepository, PagingAndSortingRepository, TagRepository, UserRepository

public interface Repository<T,​ID>
Entity Repository Interface. Supports regular Create, Read, Update and Delete operations.
Version:
1.1 19.03.20
  • Method Summary

    Modifier and Type Method Description
    void delete​(T entity)
    Deletes the given entity.
    void deleteById​(ID id)
    Deletes an entity with the given id.
    java.util.List<?> findAll()
    Retrieves all instances of the type.
    java.util.Optional<T> findById​(ID id)
    Retrieves an entity with the given id.
    java.util.Optional<T> save​(T entity)
    Saves a given entity and returns the saved instance.
    java.util.Optional<T> update​(T entity)
    Updates a given entity and returns the updated instance.
  • Method Details

    • save

      java.util.Optional<T> save​(T entity)
      Saves a given entity and returns the saved instance.
      Parameters:
      entity - not null
      Returns:
      the saved entity
    • update

      java.util.Optional<T> update​(T entity)
      Updates a given entity and returns the updated instance.
      Parameters:
      entity - not null
      Returns:
      the updated entity
    • findAll

      java.util.List<?> findAll()
      Retrieves all instances of the type.
      Returns:
      all entities
    • findById

      java.util.Optional<T> findById​(ID id)
      Retrieves an entity with the given id.
      Parameters:
      id - not null
      Returns:
      the entity with the given id if found, else Optional.empty()
    • delete

      void delete​(T entity)
      Deletes the given entity.
      Parameters:
      entity - not null
    • deleteById

      void deleteById​(ID id)
      Deletes an entity with the given id.
      Parameters:
      id - not null