From 5b57c0fdb81bae87ca487e1d0087f8927b3fd07f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 7 Dec 2015 10:09:08 +1300 Subject: Replace factory method with reflection --- src/org/traccar/model/Command.java | 7 +------ src/org/traccar/model/Device.java | 7 +------ src/org/traccar/model/Factory.java | 22 ---------------------- src/org/traccar/model/Permission.java | 7 +------ src/org/traccar/model/Position.java | 7 +------ src/org/traccar/model/Schema.java | 7 +------ src/org/traccar/model/Server.java | 7 +------ src/org/traccar/model/User.java | 7 +------ 8 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 src/org/traccar/model/Factory.java (limited to 'src/org/traccar/model') diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java index fb3a37795..df62164c2 100644 --- a/src/org/traccar/model/Command.java +++ b/src/org/traccar/model/Command.java @@ -15,7 +15,7 @@ */ package org.traccar.model; -public class Command extends Extensible implements Factory { +public class Command extends Extensible { public static final String TYPE_POSITION_SINGLE = "positionSingle"; public static final String TYPE_POSITION_PERIODIC = "positionPeriodic"; @@ -35,9 +35,4 @@ public class Command extends Extensible implements Factory { public static final String KEY_DEVICE_PASSWORD = "devicePassword"; public static final String KEY_RADIUS = "radius"; - @Override - public Command create() { - return new Command(); - } - } diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java index fd62cc691..c82581c63 100644 --- a/src/org/traccar/model/Device.java +++ b/src/org/traccar/model/Device.java @@ -17,12 +17,7 @@ package org.traccar.model; import java.util.Date; -public class Device implements Factory { - - @Override - public Device create() { - return new Device(); - } +public class Device { private long id; diff --git a/src/org/traccar/model/Factory.java b/src/org/traccar/model/Factory.java deleted file mode 100644 index 150f52b80..000000000 --- a/src/org/traccar/model/Factory.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.model; - -public interface Factory { - - Object create(); - -} diff --git a/src/org/traccar/model/Permission.java b/src/org/traccar/model/Permission.java index 065295ff9..393de2359 100644 --- a/src/org/traccar/model/Permission.java +++ b/src/org/traccar/model/Permission.java @@ -15,12 +15,7 @@ */ package org.traccar.model; -public class Permission implements Factory { - - @Override - public Permission create() { - return new Permission(); - } +public class Permission { private long userId; diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 9494da042..1a38681ca 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -17,12 +17,7 @@ package org.traccar.model; import java.util.Date; -public class Position extends Event implements Factory { - - @Override - public Position create() { - return new Position(); - } +public class Position extends Event { private Date fixTime; diff --git a/src/org/traccar/model/Schema.java b/src/org/traccar/model/Schema.java index 3d1ce755f..0d0e58831 100644 --- a/src/org/traccar/model/Schema.java +++ b/src/org/traccar/model/Schema.java @@ -15,12 +15,7 @@ */ package org.traccar.model; -public class Schema implements Factory { - - @Override - public Schema create() { - return new Schema(); - } +public class Schema { private int version; diff --git a/src/org/traccar/model/Server.java b/src/org/traccar/model/Server.java index e96a40e27..880636a4c 100644 --- a/src/org/traccar/model/Server.java +++ b/src/org/traccar/model/Server.java @@ -15,12 +15,7 @@ */ package org.traccar.model; -public class Server implements Factory { - - @Override - public Server create() { - return new Server(); - } +public class Server { private long id; diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java index 31e54752a..1531ba9e4 100644 --- a/src/org/traccar/model/User.java +++ b/src/org/traccar/model/User.java @@ -18,12 +18,7 @@ package org.traccar.model; import org.traccar.helper.Hashing; import org.traccar.web.JsonIgnore; -public class User implements Factory { - - @Override - public User create() { - return new User(); - } +public class User { private long id; -- cgit v1.2.3