1 package net.sumaris.core.extraction.vo;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import javax.annotation.Nullable;
26 import java.util.Optional;
27
28
29
30
31 public enum ExtractionRawFormatEnum {
32
33 RDB("TR", "HH", "SL", "HL"),
34 COST ("TR", "HH", "SL", "HL"),
35 FREE ("TR", "HH", "SL", "HL"),
36 SURVIVAL_TEST("TR", "HH", "SL", "HL", "ST", "RL")
37 ;
38
39 private String[] sheetNames;
40
41 ExtractionRawFormatEnum(String... sheetNames) {
42 this.sheetNames = sheetNames;
43 }
44 ExtractionRawFormatEnum() {
45 this.sheetNames = null;
46 }
47
48 public String[] getSheetNames() {
49 return sheetNames;
50 }
51
52 public static Optional<ExtractionRawFormatEnum> fromString(@Nullable String value) {
53 if (value == null) return Optional.empty();
54 try {
55 return Optional.of(valueOf(value.toUpperCase()));
56 }
57 catch(IllegalArgumentException e) {
58 return Optional.empty();
59 }
60 }
61 }