aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocol.java
diff options
context:
space:
mode:
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