1 |
alfonx |
1164 |
package skrueger.geotools.io; |
2 |
|
|
|
3 |
|
|
import java.util.HashMap; |
4 |
|
|
|
5 |
alfonx |
1295 |
public abstract class AbstractGTServerSettings<T1, T2> extends HashMap<T1, T2> |
6 |
|
|
implements ServerSettings { |
7 |
alfonx |
1164 |
|
8 |
alfonx |
1295 |
public AbstractGTServerSettings(String propString) { |
9 |
|
|
parsePropertiesString(propString); |
10 |
|
|
} |
11 |
alfonx |
1164 |
|
12 |
alfonx |
1295 |
public AbstractGTServerSettings() { |
13 |
|
|
} |
14 |
|
|
|
15 |
alfonx |
1164 |
static Integer intOrNull(String string) { |
16 |
|
|
if (string == null) |
17 |
|
|
return null; |
18 |
|
|
if (string.equals("null")) |
19 |
|
|
return null; |
20 |
|
|
return Integer.parseInt(string); |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
/** |
24 |
|
|
* Character used to separate the parameters when serializing settings to a |
25 |
|
|
* String |
26 |
|
|
*/ |
27 |
|
|
protected static final String DELIMITER = "|"; |
28 |
|
|
|
29 |
|
|
private String title; |
30 |
|
|
|
31 |
|
|
static String stringOrNull(String string) { |
32 |
|
|
if (string == null) |
33 |
|
|
return null; |
34 |
|
|
if (string.equals("null")) |
35 |
|
|
return null; |
36 |
|
|
return string; |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
public void setTitle(String title) { |
40 |
|
|
if (title != null) { |
41 |
|
|
if (title.contains(DELIMITER)) |
42 |
|
|
throw new IllegalArgumentException("Title may not contain " |
43 |
|
|
+ DELIMITER); |
44 |
|
|
if (title.contains(WfsServerList.DELIMITER)) |
45 |
|
|
throw new IllegalArgumentException("Title may not contain " |
46 |
|
|
+ WfsServerList.DELIMITER); |
47 |
|
|
} |
48 |
|
|
this.title = title; |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
public String getTitle() { |
52 |
|
|
if (title == null) |
53 |
|
|
return toString(); |
54 |
|
|
return title; |
55 |
|
|
} |
56 |
|
|
|
57 |
|
|
} |