Interface ReaderRepository<E,​ID>

  • Type Parameters:
    E - Concrete type of the entity to be managed by the repository.
    ID - Concrete type of the entity's id.
    All Known Subinterfaces:
    BasicRepository<E,​ID>

    public interface ReaderRepository<E,​ID>
    Interface for a repository with basic reading operations.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long count()
      Returns the amount of entities available in the repository.
      boolean existsById​(ID id)
      Returns whether an entity with the given id exists.
      java.lang.Iterable<E> findAll()
      Returns all the entities in the repository.
      java.util.Optional<E> findById​(ID id)
      Finds the entity with the given id.
    • Method Detail

      • count

        long count()
        Returns the amount of entities available in the repository.
        Returns:
        The amount of entities available.
      • existsById

        boolean existsById​(ID id)
                    throws java.lang.IllegalArgumentException
        Returns whether an entity with the given id exists.
        Parameters:
        id - The id of the entity to check existence.
        Returns:
        true if an entity with the given id exists, or false otherwise.
        Throws:
        java.lang.IllegalArgumentException - If the given id is null.
      • findById

        java.util.Optional<E> findById​(ID id)
                                throws java.lang.IllegalArgumentException
        Finds the entity with the given id.
        Parameters:
        id - The id of the entity to be returned.
        Returns:
        An Optional that contains the entity with the given id if it exists, or empty otherwise.
        Throws:
        java.lang.IllegalArgumentException - If the given id is null.
      • findAll

        java.lang.Iterable<E> findAll()
        Returns all the entities in the repository.
        Returns:
        All the entities.