src/main/java/de/unixwork/uwproj/Feature.java

changeset 40
b42bfc9e9983
parent 0
38775db5fdf5
child 41
75ee588d5d9e
equal deleted inserted replaced
39:3ca85da78515 40:b42bfc9e9983
1 /*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6 package de.unixwork.uwproj; 1 package de.unixwork.uwproj;
7 2
8 import java.util.LinkedList;
9 import java.util.List;
10 import org.w3c.dom.Element; 3 import org.w3c.dom.Element;
11 4
12 /** 5 import java.util.List;
13 * 6
14 * @author olaf
15 */
16 public class Feature { 7 public class Feature {
17 private String name; 8 private String name;
18 private String arg; 9 private String arg;
19 private boolean def; 10 private boolean def;
20 11
24 Feature feature = new Feature(); 15 Feature feature = new Feature();
25 String name = e.getAttribute("name"); 16 String name = e.getAttribute("name");
26 String arg = e.getAttribute("arg"); 17 String arg = e.getAttribute("arg");
27 String def = e.getAttribute("default"); 18 String def = e.getAttribute("default");
28 19
29 if(name.length() == 0) { 20 if(name.isEmpty()) {
30 throw new Exception("feature element requires name attribute"); 21 throw new Exception("feature element requires name attribute");
31 } 22 }
32 23
33 String ld = def.toLowerCase(); 24 String ld = def.toLowerCase();
34 boolean on = ld.equals("on") || ld.equals("true"); 25 boolean on = ld.equals("on") || ld.equals("true");
35 feature.setName(name); 26 feature.setName(name);
36 feature.setDefault(on); 27 feature.setDefault(on);
37 if(arg.length() == 0) { 28 if(arg.isEmpty()) {
38 feature.setArg(name); 29 feature.setArg(name);
39 } else { 30 } else {
40 feature.setArg(arg); 31 feature.setArg(arg);
41 } 32 }
42 33
60 public String getMake() { 51 public String getMake() {
61 return targetData.getMake(); 52 return targetData.getMake();
62 } 53 }
63 54
64 public boolean hasMake() { 55 public boolean hasMake() {
65 return targetData.getMake().trim().length() > 0; 56 return !targetData.getMake().trim().isEmpty();
66 } 57 }
67 58
68 public String getName() { 59 public String getName() {
69 return name; 60 return name;
70 } 61 }

mercurial