summaryrefslogtreecommitdiffstats
path: root/java/MyMyBatis/src/Model.java
blob: daa793836dd0904d112d3c28cf3772ce8a8c7515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package ch.asynk;

import lombok.Setter;
import lombok.Getter;

public class Model implements AbstractModel<Integer, Model>
{
    private @Setter @Getter Integer id;
    private @Setter @Getter String name;

    public Model()
    {
        this.id = null;
    }

    public Model(String name)
    {
        this.id = null;
        this.name = name;
    }

    @Override
    public boolean isUnsaved()
    {
        return (id == null);
    }

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