aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model/ExtendedModel.java
diff options
context:
space:
mode:
authorGavriel Fleischer <flocsy@gmail.com>2019-01-07 22:24:53 +0200
committerGavriel Fleischer <flocsy@gmail.com>2019-01-07 22:24:53 +0200
commitc0316e4a968ea73002954118cafdd958f354370f (patch)
tree1263c3657ba780b4369e862cf4b3bd48f46893b2 /src/org/traccar/model/ExtendedModel.java
parentac9ca0605726344f8a8242198102ccdd9a52635e (diff)
downloadtrackermap-server-c0316e4a968ea73002954118cafdd958f354370f.tar.gz
trackermap-server-c0316e4a968ea73002954118cafdd958f354370f.tar.bz2
trackermap-server-c0316e4a968ea73002954118cafdd958f354370f.zip
added getInteger that can return null
Diffstat (limited to 'src/org/traccar/model/ExtendedModel.java')
-rw-r--r--src/org/traccar/model/ExtendedModel.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/model/ExtendedModel.java b/src/org/traccar/model/ExtendedModel.java
index 8353d0e66..8271e41cc 100644
--- a/src/org/traccar/model/ExtendedModel.java
+++ b/src/org/traccar/model/ExtendedModel.java
@@ -108,14 +108,18 @@ public class ExtendedModel extends BaseModel {
}
}
- public int getInteger(String key) {
+ public Integer getInteger(String key, Integer defaultValue) {
if (attributes.containsKey(key)) {
return ((Number) attributes.get(key)).intValue();
} else {
- return 0;
+ return defaultValue;
}
}
+ public int getInteger(String key) {
+ return getInteger(key, 0);
+ }
+
public long getLong(String key) {
if (attributes.containsKey(key)) {
return ((Number) attributes.get(key)).longValue();