summaryrefslogtreecommitdiffstats
path: root/java/MyMyBatis/src/Model.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-04-19 16:01:19 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2017-04-19 16:01:19 +0200
commit8ec2af6e29ecb29645367a28fb1a48cf7f4f24ff (patch)
treeb30a535b4bdcde33e148110b018e39c7d6d7b989 /java/MyMyBatis/src/Model.java
parent77653bb945a5ae8adfed549fd4c5d908f5a514ae (diff)
downloadshare-8ec2af6e29ecb29645367a28fb1a48cf7f4f24ff.zip
share-8ec2af6e29ecb29645367a28fb1a48cf7f4f24ff.tar.gz
java : MyMyBatis : add AbstractModel<> to implement save in AbstractDAOOperations<>
Diffstat (limited to 'java/MyMyBatis/src/Model.java')
-rw-r--r--java/MyMyBatis/src/Model.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/java/MyMyBatis/src/Model.java b/java/MyMyBatis/src/Model.java
index 6e817ed..676cdde 100644
--- a/java/MyMyBatis/src/Model.java
+++ b/java/MyMyBatis/src/Model.java
@@ -3,18 +3,29 @@ package ch.asynk;
import lombok.Setter;
import lombok.Getter;
-public class Model
+public class Model implements AbstractModel<Integer>
{
private @Setter @Getter Integer id;
private @Setter @Getter String name;
- public Model(Integer id, String name)
+ public Model()
{
- this.id = id;
+ this.id = null;
+ }
+
+ public Model(String name)
+ {
+ this.id = null;
this.name = name;
}
@Override
+ public boolean isUnsaved()
+ {
+ return (id == null);
+ }
+
+ @Override
public String toString()
{
return String.format("model [%d] %s", id, name);