summaryrefslogtreecommitdiffstats
path: root/java/MyMyBatis/src/AbstractModel.java
blob: 7ed83aacc1c10775a6adce4637693472d4024c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package ch.asynk;

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()); }

    default void reload() { feedFrom(getDAO().selectSelf(self())); }

    void feedFrom(TObject obj);
}