Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BlankArgumentException |
|
|
1.6666666666666667;1,667 |
1 | /* |
|
2 | * Copyright 2011-2013 smartics, Kronseder & Reiner GmbH |
|
3 | * |
|
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 | * you may not use this file except in compliance with the License. |
|
6 | * You may obtain a copy of the License at |
|
7 | * |
|
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 | * |
|
10 | * Unless required by applicable law or agreed to in writing, software |
|
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 | * See the License for the specific language governing permissions and |
|
14 | * limitations under the License. |
|
15 | */ |
|
16 | package de.smartics.util.lang; |
|
17 | ||
18 | /** |
|
19 | * Signals that a given {@link String} argument is blank where is must no be |
|
20 | * blank. |
|
21 | */ |
|
22 | public class BlankArgumentException extends IllegalArgumentException |
|
23 | { |
|
24 | // ********************************* Fields ********************************* |
|
25 | ||
26 | // --- constants ------------------------------------------------------------ |
|
27 | ||
28 | /** |
|
29 | * The class version identifier. |
|
30 | * <p> |
|
31 | * The value of this constant is {@value}. |
|
32 | * </p> |
|
33 | */ |
|
34 | private static final long serialVersionUID = 1L; |
|
35 | ||
36 | // --- members -------------------------------------------------------------- |
|
37 | ||
38 | // ****************************** Initializer ******************************* |
|
39 | ||
40 | // ****************************** Constructors ****************************** |
|
41 | ||
42 | /** |
|
43 | * Convenience constructor if no argument name needs to be provided. This |
|
44 | * constructor is not recommended since the exception's message is less |
|
45 | * verbose. |
|
46 | */ |
|
47 | public BlankArgumentException() |
|
48 | { |
|
49 | 0 | this(null); |
50 | 0 | } |
51 | ||
52 | /** |
|
53 | * Convenience constructor. |
|
54 | * |
|
55 | * @param argName the name of the {@link String} argument that was blank. |
|
56 | */ |
|
57 | public BlankArgumentException(final String argName) |
|
58 | { |
|
59 | 0 | this(argName, null); |
60 | 0 | } |
61 | ||
62 | /** |
|
63 | * Default constructor. |
|
64 | * |
|
65 | * @param argName the name of the {@link String} argument that was blank. |
|
66 | * @param message an optional additional message to provide information about |
|
67 | * the context of the argument. |
|
68 | * @see java.lang.IllegalArgumentException#IllegalArgumentException(java.lang.String) |
|
69 | */ |
|
70 | public BlankArgumentException(final String argName, final String message) |
|
71 | { |
|
72 | 0 | super((argName == null ? "Argument" : argName) + " must not be blank" |
73 | + (message != null ? ": " + message : ".")); |
|
74 | 0 | } |
75 | ||
76 | // ****************************** Inner Classes ***************************** |
|
77 | ||
78 | // ********************************* Methods ******************************** |
|
79 | ||
80 | // --- init ----------------------------------------------------------------- |
|
81 | ||
82 | // --- get&set -------------------------------------------------------------- |
|
83 | ||
84 | // --- business ------------------------------------------------------------- |
|
85 | ||
86 | // --- object basics -------------------------------------------------------- |
|
87 | ||
88 | } |