aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/BaseProtocolDecoder.java
diff options
context:
space:
mode:
authorjon-stumpf <jon.stumpf@gmail.com>2014-10-10 22:25:02 -0400
committerjon-stumpf <jon.stumpf@gmail.com>2014-10-21 16:01:41 -0400
commitf0790eba6f3194daf4677c27e8259f783aae3207 (patch)
tree7e206023124d1e9f1705af1f11d0eaede08edab1 /src/org/traccar/BaseProtocolDecoder.java
parent1948e0f63202dddca607dcb51fa9a92a83e49154 (diff)
downloadtrackermap-server-f0790eba6f3194daf4677c27e8259f783aae3207.tar.gz
trackermap-server-f0790eba6f3194daf4677c27e8259f783aae3207.tar.bz2
trackermap-server-f0790eba6f3194daf4677c27e8259f783aae3207.zip
Made BaseProtocolDecoder members "final" as they should not change after construction.
Diffstat (limited to 'src/org/traccar/BaseProtocolDecoder.java')
-rw-r--r--src/org/traccar/BaseProtocolDecoder.java34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/org/traccar/BaseProtocolDecoder.java b/src/org/traccar/BaseProtocolDecoder.java
index 3976ba9e8..e4a3448f1 100644
--- a/src/org/traccar/BaseProtocolDecoder.java
+++ b/src/org/traccar/BaseProtocolDecoder.java
@@ -29,22 +29,14 @@ import org.traccar.database.DataManager;
*/
public abstract class BaseProtocolDecoder extends OneToOneDecoder {
- private ServerManager serverManager;
- private DataManager dataManager;
+ private final ServerManager serverManager;
+ private final DataManager dataManager;
private final String protocol;
- public final void setDataManager(DataManager dataManager) {
- this.dataManager = dataManager;
- }
-
public final DataManager getDataManager() {
return dataManager;
}
- public final void setServerManager(ServerManager serverManager) {
- this.serverManager = serverManager;
- }
-
public final ServerManager getServerManager() {
return serverManager;
}
@@ -53,21 +45,17 @@ public abstract class BaseProtocolDecoder extends OneToOneDecoder {
return protocol;
}
- public BaseProtocolDecoder() {
- protocol = null;
- }
-
- public BaseProtocolDecoder(ServerManager serverManager) {
- // Only used by test classes now
- assert (serverManager == null) :
- "BaseProtocolDecoder() initialized with non-NULL serverManager";
-
- if (serverManager != null) {
- this.serverManager = serverManager;
- dataManager = serverManager.getDataManager();
- }
+ public BaseProtocolDecoder(DataManager dataManager) {
+ // This constructor must only be used by test classes.
+ // There should be a way to check this at compile time.
+
+ assert (dataManager != null) :
+ "BaseProtocolDecoder() initialized with NULL dataManager";
+ serverManager = null;
protocol = null;
+
+ this.dataManager = dataManager;
}
public BaseProtocolDecoder(ServerManager serverManager, String protocol) {