8 import static de.unixwork.uwproj.Util.shId; |
8 import static de.unixwork.uwproj.Util.shId; |
9 |
9 |
10 public class Feature { |
10 public class Feature { |
11 private String name; |
11 private String name; |
12 private String arg; |
12 private String arg; |
13 private boolean def; |
13 private boolean auto; |
14 |
14 |
15 private TargetData targetData; |
15 private TargetData targetData; |
16 |
16 |
17 public static Feature parse(Project project, Element e) throws Exception { |
17 public static Feature parse(Project project, Element e) throws Exception { |
18 Feature feature = new Feature(); |
18 Feature feature = new Feature(); |
19 String name = e.getAttribute("name"); |
19 String name = e.getAttribute("name"); |
20 String arg = e.getAttribute("arg"); |
20 String arg = e.getAttribute("arg"); |
21 String def = e.getAttribute("default"); |
21 String auto = e.getAttribute("default"); |
22 |
22 |
23 if (name.isBlank()) { |
23 if (name.isBlank()) { |
24 throw new Exception("feature element requires name attribute"); |
24 throw new Exception("feature element requires name attribute"); |
25 } |
25 } |
26 |
26 |
27 feature.setName(name); |
27 feature.setName(name); |
28 feature.setDefault(Boolean.parseBoolean(def)); |
28 feature.setAuto(Boolean.parseBoolean(auto)); |
29 if (arg.isBlank()) { |
29 if (arg.isBlank()) { |
30 feature.setArg(name); |
30 feature.setArg(name); |
31 } else { |
31 } else { |
32 feature.setArg(arg); |
32 feature.setArg(arg); |
33 } |
33 } |