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 longcount()Returns the amount of entities available in the repository.booleanexistsById(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 givenid.
-
-
-
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:
trueif an entity with the givenidexists, orfalseotherwise.- Throws:
java.lang.IllegalArgumentException- If the givenidisnull.
-
findById
java.util.Optional<E> findById(ID id) throws java.lang.IllegalArgumentException
Finds the entity with the givenid.- Parameters:
id- The id of the entity to be returned.- Returns:
- An
Optionalthat contains the entity with the givenidif it exists, or empty otherwise. - Throws:
java.lang.IllegalArgumentException- If the givenidisnull.
-
findAll
java.lang.Iterable<E> findAll()
Returns all the entities in the repository.- Returns:
- All the entities.
-
-