From 8ea3c0b738e3c2bbb6e7bad367544caab0683851 Mon Sep 17 00:00:00 2001 From: Thibaud Date: Thu, 3 Jan 2019 00:34:26 +0100 Subject: [PATCH] Refactoring --- persistence/pom.xml | 2 +- .../src/main/java/fr/gasser/daoexample/dao/Dao.java | 12 ++++++------ .../gasser/daoexample/dao/dummy/DisciplineDao.java | 2 +- .../fr/gasser/daoexample/dao/dummy/StudentDao.java | 2 +- .../fr/gasser/daoexample/dao/dummy/TeacherDao.java | 2 +- .../daoexample/dao/sqlite/StudentSQLiteDao.java | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/persistence/pom.xml b/persistence/pom.xml index 1893e05..bf6bb73 100644 --- a/persistence/pom.xml +++ b/persistence/pom.xml @@ -10,7 +10,7 @@ 1.0-SNAPSHOT - patterns + persitence 1.0-SNAPSHOT diff --git a/persistence/src/main/java/fr/gasser/daoexample/dao/Dao.java b/persistence/src/main/java/fr/gasser/daoexample/dao/Dao.java index 9763ff3..709e8e8 100644 --- a/persistence/src/main/java/fr/gasser/daoexample/dao/Dao.java +++ b/persistence/src/main/java/fr/gasser/daoexample/dao/Dao.java @@ -4,15 +4,15 @@ import fr.gasser.daoexample.model.Entity; import java.util.List; -public abstract class Dao { +public interface Dao { - public abstract boolean create(T obj); + boolean create(T obj); - public abstract T find(int id); + T find(int id); - public abstract List findAll(); + List findAll(); - public abstract boolean update(T obj); + boolean update(T obj); - public abstract boolean delete(T obj); + boolean delete(T obj); } diff --git a/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/DisciplineDao.java b/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/DisciplineDao.java index 13846ce..5021a66 100644 --- a/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/DisciplineDao.java +++ b/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/DisciplineDao.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class DisciplineDao extends Dao { +public class DisciplineDao implements Dao { // Emulate discipline table private final static List DISCIPLINES = new ArrayList<>(Arrays.asList( diff --git a/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/StudentDao.java b/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/StudentDao.java index c0a6601..2228279 100644 --- a/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/StudentDao.java +++ b/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/StudentDao.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class StudentDao extends Dao { +public class StudentDao implements Dao { // Emulate student table private final static List students = new ArrayList<>(Arrays.asList( diff --git a/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/TeacherDao.java b/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/TeacherDao.java index a4796c1..708dc8c 100644 --- a/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/TeacherDao.java +++ b/persistence/src/main/java/fr/gasser/daoexample/dao/dummy/TeacherDao.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class TeacherDao extends Dao { +public class TeacherDao implements Dao { // Emulate teacher table private final static List teachers = new ArrayList<>(Arrays.asList( diff --git a/persistence/src/main/java/fr/gasser/daoexample/dao/sqlite/StudentSQLiteDao.java b/persistence/src/main/java/fr/gasser/daoexample/dao/sqlite/StudentSQLiteDao.java index 077b957..ef42787 100644 --- a/persistence/src/main/java/fr/gasser/daoexample/dao/sqlite/StudentSQLiteDao.java +++ b/persistence/src/main/java/fr/gasser/daoexample/dao/sqlite/StudentSQLiteDao.java @@ -15,7 +15,7 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.List; -public class StudentSQLiteDao extends Dao { +public class StudentSQLiteDao implements Dao { private static final Logger LOGGER = LoggerFactory.getLogger(StudentSQLiteDao.class); private final ConnectionWrapper wrapper;