aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 15:53:41 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-17 15:53:41 +1200
commit4ab007201bd177a2fbf46a90b7b73262c5792caf (patch)
tree08cdcec2d45ae876c7330968f47e7169a7ee8405 /src/org/traccar
parentf5868e7cd0e40706c19c5a5f28490b8968a50b88 (diff)
downloadtrackermap-server-4ab007201bd177a2fbf46a90b7b73262c5792caf.tar.gz
trackermap-server-4ab007201bd177a2fbf46a90b7b73262c5792caf.tar.bz2
trackermap-server-4ab007201bd177a2fbf46a90b7b73262c5792caf.zip
Support for optional values
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/model/Extensible.java38
1 files changed, 31 insertions, 7 deletions
diff --git a/src/org/traccar/model/Extensible.java b/src/org/traccar/model/Extensible.java
index b8c83bb21..b7953d8a6 100644
--- a/src/org/traccar/model/Extensible.java
+++ b/src/org/traccar/model/Extensible.java
@@ -40,20 +40,44 @@ public class Extensible {
this.attributes = attributes;
}
- public void set(String key, boolean value) {
+ 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, Byte value) {
+ if (value != null) {
+ attributes.put(key, value.intValue());
+ }
}
- public void set(String key, long value) {
- attributes.put(key, value);
+ public void set(String key, Short value) {
+ if (value != null) {
+ attributes.put(key, value.intValue());
+ }
}
- public void set(String key, double value) {
- attributes.put(key, value);
+ public void set(String key, Integer value) {
+ if (value != null) {
+ attributes.put(key, value);
+ }
+ }
+
+ public void set(String key, Long value) {
+ if (value != null) {
+ attributes.put(key, value);
+ }
+ }
+
+ public void set(String key, Float value) {
+ if (value != null) {
+ attributes.put(key, value.doubleValue());
+ }
+ }
+
+ public void set(String key, Double value) {
+ if (value != null) {
+ attributes.put(key, value);
+ }
}
public void set(String key, String value) {