blob: b5f6393b6084172ebc0125ce3265a819d13f456e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package org.traccar.command;
import org.traccar.model.Factory;
public enum CommandType implements Factory {
STOP_POSITIONING(NoParameterCommand.class),
FIX_POSITIONING(FixPositioningCommand.class),
STOP_ENGINE(NoParameterCommand.class),
RESUME_ENGINE(NoParameterCommand.class);
private Class<? extends GpsCommand> commandClass;
CommandType(Class<? extends GpsCommand> commandClass) {
this.commandClass = commandClass;
}
@Override
public Object create() {
try {
return commandClass.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
|