diff options
Diffstat (limited to 'java/MyMyBatis/src/AbstractModel.java')
-rw-r--r-- | java/MyMyBatis/src/AbstractModel.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/java/MyMyBatis/src/AbstractModel.java b/java/MyMyBatis/src/AbstractModel.java index 81bab76..365472c 100644 --- a/java/MyMyBatis/src/AbstractModel.java +++ b/java/MyMyBatis/src/AbstractModel.java @@ -1,7 +1,15 @@ package ch.asynk; -public interface AbstractModel<TIdentity> +public interface AbstractModel<TIdentity, TObject> { boolean isUnsaved(); + + TObject self(); + + AbstractMapper<TIdentity, TObject> getDAO(); + + default void save() { getDAO().save(self()); } + + default int delete() { return getDAO().delete(self()); } } |