diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2017-04-19 16:52:31 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2017-04-19 16:52:31 +0200 |
commit | 4eaaddb6813b0f563c9022e67f7a4d4a2fc8bae1 (patch) | |
tree | e0be79c1294562957089ca8641f65d6cf83677af /java/MyMyBatis/src/Model.java | |
parent | 6fcde2655e8aedd56bff1de4e85bb83fee15c591 (diff) | |
download | share-4eaaddb6813b0f563c9022e67f7a4d4a2fc8bae1.zip share-4eaaddb6813b0f563c9022e67f7a4d4a2fc8bae1.tar.gz |
java : MyMyBatis : use java 8 default interface implementation to gain free save() and delete() methods
Diffstat (limited to 'java/MyMyBatis/src/Model.java')
-rw-r--r-- | java/MyMyBatis/src/Model.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/MyMyBatis/src/Model.java b/java/MyMyBatis/src/Model.java index 676cdde..daa7938 100644 --- a/java/MyMyBatis/src/Model.java +++ b/java/MyMyBatis/src/Model.java @@ -3,7 +3,7 @@ package ch.asynk; import lombok.Setter; import lombok.Getter; -public class Model implements AbstractModel<Integer> +public class Model implements AbstractModel<Integer, Model> { private @Setter @Getter Integer id; private @Setter @Getter String name; @@ -26,6 +26,18 @@ public class Model implements AbstractModel<Integer> } @Override + public Model self() + { + return this; + } + + @Override + public ModelMapper getDAO() + { + return ModelDAO.getInstance(); + } + + @Override public String toString() { return String.format("model [%d] %s", id, name); |