diff options
Diffstat (limited to 'java/MyMyBatis/src/Model.java')
-rw-r--r-- | java/MyMyBatis/src/Model.java | 17 |
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); |