]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/java/net/ktnx/mobileledger/db/Option.java
another step towards surrogate ID db objects
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / Option.java
1 /*
2  * Copyright © 2021 Damyan Ivanov.
3  * This file is part of MoLe.
4  * MoLe is free software: you can distribute it and/or modify it
5  * under the term of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your opinion), any later version.
8  *
9  * MoLe is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License terms for details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
16  */
17
18 package net.ktnx.mobileledger.db;
19
20 import androidx.annotation.NonNull;
21 import androidx.room.ColumnInfo;
22 import androidx.room.Entity;
23
24 import org.jetbrains.annotations.NotNull;
25
26 @Entity(tableName = "options", primaryKeys = {"profile_id", "name"})
27 public class Option {
28     @ColumnInfo(name = "profile_id")
29     private long profileId;
30     @NonNull
31     @ColumnInfo
32     private String name;
33     @ColumnInfo
34     private String value;
35     public Option(long profileId, @NotNull String name, String value) {
36         this.profileId = profileId;
37         this.name = name;
38         this.value = value;
39     }
40     public long getProfileId() {
41         return profileId;
42     }
43     public void setProfileId(long profileId) {
44         this.profileId = profileId;
45     }
46     @NonNull
47     public String getName() {
48         return name;
49     }
50     public void setName(@NonNull String name) {
51         this.name = name;
52     }
53     public String getValue() {
54         return value;
55     }
56     public void setValue(String value) {
57         this.value = value;
58     }
59     @NonNull
60     @Override
61     public String toString() {
62         return getName();
63     }
64 }