1 package org.apache.maven.surefire.booter;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.apache.maven.surefire.shared.utils.StringUtils.isBlank;
23
24
25
26
27 public enum ProcessCheckerType
28 {
29 PING( "ping" ),
30 NATIVE( "native" ),
31 ALL( "all" );
32
33 private final String type;
34
35 ProcessCheckerType( String type )
36 {
37 this.type = type;
38 }
39
40
41
42
43
44
45
46 public static ProcessCheckerType toEnum( String type )
47 {
48 if ( isBlank( type ) )
49 {
50 return null;
51 }
52
53 for ( ProcessCheckerType e : values() )
54 {
55 if ( e.type.equals( type ) )
56 {
57 return e;
58 }
59 }
60
61 throw new IllegalArgumentException( "unknown process checker" );
62 }
63
64 public String getType()
65 {
66 return type;
67 }
68
69 public static boolean isValid( String type )
70 {
71 try
72 {
73 toEnum( type );
74 return true;
75 }
76 catch ( IllegalArgumentException e )
77 {
78 return false;
79 }
80 }
81 }