aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/Message.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
committerAbyss777 <abyss@fox5.ru>2016-05-26 09:30:43 +0500
commitaa12e5c750e771016545269ffa39409b06b47eee (patch)
treed21b4414b532bfc53c9a905f3caa09f70b43b59e /src/org/traccar/model/Message.java
parentac2405f0d57fac51fe95aa755f90fe82f26f73bc (diff)
downloadtrackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.gz
trackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.tar.bz2
trackermap-server-aa12e5c750e771016545269ffa39409b06b47eee.zip
- Simplification of the hierarchy of models classes
- Removed automatically founded unnecessary imports
Diffstat (limited to 'src/org/traccar/model/Message.java')
-rw-r--r--src/org/traccar/model/Message.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/org/traccar/model/Message.java b/src/org/traccar/model/Message.java
index bac6661a8..8722acc16 100644
--- a/src/org/traccar/model/Message.java
+++ b/src/org/traccar/model/Message.java
@@ -15,6 +15,9 @@
*/
package org.traccar.model;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
public class Message {
private long deviceId;
@@ -37,4 +40,42 @@ public class Message {
this.type = type;
}
+ private Map<String, Object> attributes = new LinkedHashMap<>();
+
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, Object> attributes) {
+ this.attributes = attributes;
+ }
+
+ public void set(String key, boolean value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, int value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, long value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, double value) {
+ attributes.put(key, value);
+ }
+
+ public void set(String key, String value) {
+ if (value != null && !value.isEmpty()) {
+ attributes.put(key, value);
+ }
+ }
+
+ public void add(Map.Entry<String, Object> entry) {
+ if (entry != null && entry.getValue() != null) {
+ attributes.put(entry.getKey(), entry.getValue());
+ }
+ }
+
}