public interface Repository<T,PK>
Modifier and Type | Method and Description |
---|---|
boolean |
add(T entity)
Creates a new an entity in the persistence layer.
|
java.lang.Iterable<T> |
all()
gets all entities from the repository.
|
void |
delete(T entity) |
java.util.Optional<T> |
findById(PK id)
gets the entity with the specified id
|
T |
save(T entity)
Saves an entity either by creating it or updating it in the persistence.
|
long |
size()
returns the number of entities in the repository.
|
T save(T entity)
entity
- boolean add(T entity)
entity
- java.lang.Iterable<T> all()
java.util.Optional<T> findById(PK id)
id
- long size()
void delete(T entity)