File tree Expand file tree Collapse file tree 1 file changed +9
-33
lines changed
api/src/main/java/com/faforever/commons/api/dto Expand file tree Collapse file tree 1 file changed +9
-33
lines changed Original file line number Diff line number Diff line change 11package com .faforever .commons .api .dto ;
22
3+ import com .fasterxml .jackson .annotation .JsonEnumDefaultValue ;
34import lombok .AllArgsConstructor ;
4- import lombok .Getter ;
5- import lombok .extern .slf4j .Slf4j ;
65
7- import java .util .HashMap ;
8- import java .util .Map ;
9-
10- @ Slf4j
11- @ Getter
126@ AllArgsConstructor
137public enum VictoryCondition {
14- // Order is crucial
15- DEMORALIZATION (0 ),
16- DOMINATION (1 ),
17- ERADICATION (2 ),
18- SANDBOX (3 ),
19- UNKNOWN ("unknown" );
20-
21- private static final Map <Object , VictoryCondition > fromNumber ;
22-
23- static {
24- fromNumber = new HashMap <>();
25- for (VictoryCondition victoryCondition : values ()) {
26- fromNumber .put (victoryCondition .value , victoryCondition );
27- }
28- }
29-
30- private final Object value ;
31-
32- public static VictoryCondition fromNumber (Object number ) {
33- VictoryCondition victoryCondition = fromNumber .get (number );
34- if (victoryCondition == null ) {
35- log .warn ("Unknown victory condition: {}" , number );
36- return UNKNOWN ;
37- }
38- return victoryCondition ;
39- }
8+ // Order is crucial
9+ DEMORALIZATION ,
10+ DOMINATION ,
11+ ERADICATION ,
12+ SANDBOX ,
13+ DECAPITATION ,
14+ @ JsonEnumDefaultValue
15+ UNKNOWN ;
4016}
You can’t perform that action at this time.
0 commit comments