1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.surefire.api.booter;
20
21
22
23
24
25
26
27
28 public enum Shutdown {
29 DEFAULT("testset"),
30 EXIT("exit"),
31 KILL("kill");
32
33 private final String param;
34
35 Shutdown(String param) {
36 this.param = param;
37 }
38
39 public String getParam() {
40 return param;
41 }
42
43 public boolean isKill() {
44 return this == KILL;
45 }
46
47 public boolean isExit() {
48 return this == EXIT;
49 }
50
51 public boolean isDefaultShutdown() {
52 return this == DEFAULT;
53 }
54
55 public static boolean isKnown(String param) {
56 for (Shutdown shutdown : values()) {
57 if (shutdown.param.equals(param)) {
58 return true;
59 }
60 }
61 return false;
62 }
63
64 public static String listParameters() {
65 StringBuilder values = new StringBuilder();
66 for (Shutdown shutdown : values()) {
67 if (values.length() != 0) {
68 values.append(", ");
69 }
70 values.append(shutdown.getParam());
71 }
72 return values.toString();
73 }
74
75 public static Shutdown parameterOf(String parameter) {
76 for (Shutdown shutdown : values()) {
77 if (shutdown.param.equals(parameter)) {
78 return shutdown;
79 }
80 }
81 return DEFAULT;
82 }
83 }