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

Fri, 06 Oct 2023 20:47:39 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 06 Oct 2023 20:47:39 +0200
changeset 84
7e523ed15146
parent 41
75ee588d5d9e
child 113
24f32dbd88cd
permissions
-rw-r--r--

release version 0.1.0

0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 package de.unixwork.uwproj;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 public class Define {
41
75ee588d5d9e some more code cleanup
Mike Becker <universe@uap-core.de>
parents: 40
diff changeset
4 private final String name;
75ee588d5d9e some more code cleanup
Mike Becker <universe@uap-core.de>
parents: 40
diff changeset
5 private final String value;
0
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 public Define(String name, String value) {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 this.name = name;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 this.value = value;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 public String getName() {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 return name;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 public String getValue() {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 return value;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 public String toFlags() {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 if(name == null) {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 return "";
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 } else if(value == null) {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 return "-D"+name;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 } else {
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 return "-D"+name + "=" + value;
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 }
38775db5fdf5 add existing source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 }

mercurial