aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/User.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-03 12:09:00 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-03 12:09:00 +1200
commit18127a2dfc362ffd7de4110e013a10a9f894469b (patch)
tree24ced00567acbc751985b71ffd99ce067213a34d /src/org/traccar/model/User.java
parent427113e0aabf1b8ab54288263c3e809f292a5a05 (diff)
downloadtrackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.tar.gz
trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.tar.bz2
trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.zip
Implmenet reflection json conversion
Diffstat (limited to 'src/org/traccar/model/User.java')
-rw-r--r--src/org/traccar/model/User.java47
1 files changed, 7 insertions, 40 deletions
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java
index 02e5c0c4f..ea4617e54 100644
--- a/src/org/traccar/model/User.java
+++ b/src/org/traccar/model/User.java
@@ -15,18 +15,19 @@
*/
package org.traccar.model;
-import javax.json.Json;
-import javax.json.JsonObject;
-import javax.json.JsonObjectBuilder;
-import org.traccar.database.Convertable;
-
-public class User implements Convertable {
+public class User {
private long id;
+ public long getId() { return id; }
+ public void setId(long id) { this.id = id; }
private String email;
+ public String getEmail() { return email; }
+ public void setEmail(String email) { this.email = email; }
private String password;
+ public String getPassword() { return password; }
+ public void setPassword(String password) { this.password = password; }
private boolean readonly;
@@ -46,38 +47,4 @@ public class User implements Convertable {
private int zoom;
- @Override
- public JsonObject toJson() {
- JsonObjectBuilder json = Json.createObjectBuilder();
- json.add("id", id);
- json.add("email", email);
- json.add("password", password);
- json.add("readonly", readonly);
- json.add("admin", admin);
- json.add("map", map);
- json.add("language", language);
- json.add("distanceUnit", distanceUnit);
- json.add("speedUnit", speedUnit);
- json.add("latitude", latitude);
- json.add("longitude", longitude);
- json.add("zoom", zoom);
- return json.build();
- }
-
- @Override
- public void fromJson(JsonObject json) {
- id = json.getJsonNumber("id").longValue();
- email = json.getString("email");
- password = json.getString("password");
- readonly = json.getBoolean("readonly");
- admin = json.getBoolean("admin");
- map = json.getString("map");
- language = json.getString("language");
- distanceUnit = json.getString("distanceUnit");
- speedUnit = json.getString("speedUnit");
- latitude = json.getJsonNumber("latitude").doubleValue();
- longitude = json.getJsonNumber("longitude").doubleValue();
- zoom = json.getJsonNumber("zoom").intValue();
- }
-
}