aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocol.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-10-17 16:00:44 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-10-17 16:00:45 +1300
commit566e3dcce47604d661909674308262cc7ddd30e1 (patch)
tree580f9c06d36efe1656e2ef1b76b6c2cab2281786 /src/org/traccar/BaseProtocol.java
parent7eda7ec149136829911c154a3ed8d71e3825609a (diff)
downloadtrackermap-server-566e3dcce47604d661909674308262cc7ddd30e1.tar.gz
trackermap-server-566e3dcce47604d661909674308262cc7ddd30e1.tar.bz2
trackermap-server-566e3dcce47604d661909674308262cc7ddd30e1.zip
Automatically get protocol name
Diffstat (limited to 'src/org/traccar/BaseProtocol.java')
-rw-r--r--src/org/traccar/BaseProtocol.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/BaseProtocol.java b/src/org/traccar/BaseProtocol.java
index a78143167..6e44b7285 100644
--- a/src/org/traccar/BaseProtocol.java
+++ b/src/org/traccar/BaseProtocol.java
@@ -34,8 +34,13 @@ public abstract class BaseProtocol implements Protocol {
private StringProtocolEncoder textCommandEncoder = null;
- public BaseProtocol(String name) {
- this.name = name;
+ public static String nameFromClass(Class<?> clazz) {
+ String className = clazz.getSimpleName();
+ return className.substring(0, className.length() - 8).toLowerCase();
+ }
+
+ public BaseProtocol() {
+ name = nameFromClass(getClass());
}
@Override