diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-03 12:09:00 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-03 12:09:00 +1200 |
commit | 18127a2dfc362ffd7de4110e013a10a9f894469b (patch) | |
tree | 24ced00567acbc751985b71ffd99ce067213a34d /src/org/traccar/model/Device.java | |
parent | 427113e0aabf1b8ab54288263c3e809f292a5a05 (diff) | |
download | trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.tar.gz trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.tar.bz2 trackermap-server-18127a2dfc362ffd7de4110e013a10a9f894469b.zip |
Implmenet reflection json conversion
Diffstat (limited to 'src/org/traccar/model/Device.java')
-rw-r--r-- | src/org/traccar/model/Device.java | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java index 2fb26d282..b40e694b8 100644 --- a/src/org/traccar/model/Device.java +++ b/src/org/traccar/model/Device.java @@ -15,18 +15,9 @@ */ package org.traccar.model; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.text.ParseException; import java.util.Date; -import javax.json.Json; -import javax.json.JsonObject; -import javax.json.JsonObjectBuilder; -import org.traccar.database.Convertable; -import org.traccar.database.ObjectConverter; -import org.traccar.helper.Log; -public class Device implements Convertable, Factory { +public class Device implements Factory { @Override public Device create() { @@ -53,28 +44,4 @@ public class Device implements Convertable, Factory { private long dataId; - @Override - public JsonObject toJson() { - JsonObjectBuilder json = Json.createObjectBuilder(); - ObjectConverter.putLong(json, "id", id); - ObjectConverter.putString(json, "name", name); - ObjectConverter.putString(json, "uniqueId", uniqueId); - ObjectConverter.putString(json, "status", status); - ObjectConverter.putDate(json, "lastUpdate", lastUpdate); - ObjectConverter.putLong(json, "positionId", positionId); - ObjectConverter.putLong(json, "dataId", dataId); - return json.build(); - } - - @Override - public void fromJson(JsonObject json) throws ParseException { - id = ObjectConverter.getLong(json, "id"); - name = ObjectConverter.getString(json, "name"); - uniqueId = ObjectConverter.getString(json, "uniqueId"); - status = ObjectConverter.getString(json, "status"); - lastUpdate = ObjectConverter.getDate(json, "lastUpdate"); - positionId = ObjectConverter.getLong(json, "positionId"); - dataId = ObjectConverter.getLong(json, "dataId"); - } - } |