Compare commits
No commits in common. "728cb4f84fd7b2417341f371a820fc2dee19a226" and "01742240896f2ab9ed4447fceae3f9a1f4177d2d" have entirely different histories.
728cb4f84f
...
0174224089
@ -1,35 +0,0 @@
|
||||
package ru.kamask.pet.todo.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import ru.kamask.pet.todo.model.Identifiable;
|
||||
import ru.kamask.pet.todo.repo.Repository;
|
||||
|
||||
public class EntityService<T extends Identifiable> {
|
||||
private final Repository<T> repo;
|
||||
|
||||
protected EntityService(Repository<T> repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
protected void save(T obj) {
|
||||
repo.save(obj);
|
||||
}
|
||||
|
||||
protected Optional<T> getById(int id) {
|
||||
return repo.findById(id);
|
||||
}
|
||||
|
||||
protected List<T> getAll() {
|
||||
return repo.findAll();
|
||||
}
|
||||
|
||||
protected void remove(int id) {
|
||||
repo.delete(id);
|
||||
}
|
||||
|
||||
protected boolean has(int id) {
|
||||
return repo.has(id);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user