aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/session
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-30 16:58:34 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-30 16:58:34 -0700
commit9a68d1045f30bf8397d6cbf90df8f42f40979591 (patch)
treeddaea6ff681f482a4e062127f969fe0cbe40f244 /src/main/java/org/traccar/session
parent2e83b23d258e74df6dfc1c860c2abf9b1b816181 (diff)
downloadtrackermap-server-9a68d1045f30bf8397d6cbf90df8f42f40979591.tar.gz
trackermap-server-9a68d1045f30bf8397d6cbf90df8f42f40979591.tar.bz2
trackermap-server-9a68d1045f30bf8397d6cbf90df8f42f40979591.zip
Add generic variable store
Diffstat (limited to 'src/main/java/org/traccar/session')
-rw-r--r--src/main/java/org/traccar/session/DeviceSession.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/session/DeviceSession.java b/src/main/java/org/traccar/session/DeviceSession.java
index 6fe5b5d57..0d5b283fe 100644
--- a/src/main/java/org/traccar/session/DeviceSession.java
+++ b/src/main/java/org/traccar/session/DeviceSession.java
@@ -15,7 +15,8 @@
*/
package org.traccar.session;
-import java.util.TimeZone;
+import java.util.HashMap;
+import java.util.Map;
public class DeviceSession {
@@ -29,14 +30,25 @@ public class DeviceSession {
return deviceId;
}
- private TimeZone timeZone;
+ public static final String KEY_TIMEZONE = "timezone";
- public void setTimeZone(TimeZone timeZone) {
- this.timeZone = timeZone;
+ private final Map<String, Object> locals = new HashMap<>();
+
+ public boolean contains(String key) {
+ return locals.containsKey(key);
+ }
+
+ public void set(String key, Object value) {
+ if (value != null) {
+ locals.put(key, value);
+ } else {
+ locals.remove(key);
+ }
}
- public TimeZone getTimeZone() {
- return timeZone;
+ @SuppressWarnings("unchecked")
+ public <T> T get(String key) {
+ return (T) locals.get(key);
}
}