1 | |
package ca.uhn.hl7v2.hoh.util; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | 5 | public abstract class Validate { |
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
public static void notNull(Object theObject, String theName) { |
14 | 65 | assert theName != null; |
15 | |
|
16 | 65 | if (theObject == null) { |
17 | 0 | throw new IllegalArgumentException(theName + " can not be null"); |
18 | |
} |
19 | 65 | } |
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public static void notBlank(String theObject, String theName) { |
26 | 0 | assert theName != null; |
27 | |
|
28 | 0 | if (theObject == null) { |
29 | 0 | throw new IllegalArgumentException(theName + " can not be null"); |
30 | |
} |
31 | |
|
32 | 0 | if (theObject.trim().length() == 0) { |
33 | 0 | throw new IllegalArgumentException(theName + " can not be empty"); |
34 | |
} |
35 | 0 | } |
36 | |
|
37 | |
public static void propertySet(Object theValue, String theName) { |
38 | 60 | if (theValue == null) { |
39 | 0 | throw new IllegalStateException("Property \"" + theName + "\" is not set"); |
40 | |
} |
41 | 60 | } |
42 | |
|
43 | |
} |