summaryrefslogtreecommitdiffstats
path: root/java/MyMyBatis/src/Model.java
blob: a8b1bca51477a925cf771bdf22cab23b507b4002 (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
46
47
48
49
50
51
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);
    }

    @Override
    public void feedFrom(Model other)
    {
        this.name = other.name;
    }
}