123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package db.table;
- import java.util.List;
- import java.util.Optional;
- import db.Table;
- import db.annotation.DbTable;
- import entity.Espace;
- @DbTable(name = "Espace", entity = Espace.class)
- public class EspaceTable extends Table<Espace>{
-
- private static EspaceTable instance;
-
- private EspaceTable() {
- // Private constructor for singleton
- }
-
- public Espace getByLibelle(String lib) {
- List<Espace> list = getByField("LIBELLE", lib);
- if(list.isEmpty()) {
- return null;
- }
- return list.get(0);
- }
-
- public Optional<Espace> findByLibelle(String lib) {
- Espace obj = getByLibelle(lib);
- if (obj == null) {
- return Optional.empty();
- }
- return Optional.of(obj);
- }
-
- public static EspaceTable getInstance() {
- if(instance == null) {
- instance = new EspaceTable();
- }
- return instance;
- }
- }
|