1 /*******************************************************************************
2 * Copyright 2013 André Rouél and Dominik Seichter
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 net.sf.qualitycheck.exception;
17
18 import javax.annotation.Nonnull;
19 import javax.annotation.Nullable;
20
21 /**
22 * Thrown to indicate that a method was passed arguments which was expected to be greater or equal than another object
23 * but was not.
24 *
25 * @author André Rouél
26 * @author Dominik Seichter
27 */
28 public class IllegalNotGreaterOrEqualThanException extends RuntimeException {
29
30 private static final long serialVersionUID = 581207857845351903L;
31
32 /**
33 * Default message to indicate that the given arguments must be greater or equal then another object.
34 */
35 protected static final String DEFAULT_MESSAGE = "Argument must be greater or equal than a defined value.";
36
37 /**
38 * Constructs an {@code IllegalNotGreaterOrEqualThanException} with the default message
39 * {@link IllegalNotGreaterOrEqualThanException#DEFAULT_MESSAGE}.
40 */
41 public IllegalNotGreaterOrEqualThanException() {
42 super(DEFAULT_MESSAGE);
43 }
44
45 /**
46 * Constructs an {@code IllegalNotGreaterThanException} with a given message.
47 *
48 * @param message
49 * explains why the object must greater than another object
50 */
51 public IllegalNotGreaterOrEqualThanException(@Nonnull final String message) {
52 super(message);
53 }
54
55 /**
56 * Constructs a new exception with a given message.
57 *
58 * @param message
59 * explains why the object must greater or equal than another object
60 * @param cause
61 * the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). (A
62 * {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.)
63 */
64 public IllegalNotGreaterOrEqualThanException(@Nonnull final String message, @Nullable final Throwable cause) {
65 super(message, cause);
66 }
67
68 /**
69 * Constructs a new exception with the default message {@link IllegalNotGreaterOrEqualThanException#DEFAULT_MESSAGE}
70 * .
71 *
72 * @param cause
73 * the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). (A
74 * {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.)
75 */
76 public IllegalNotGreaterOrEqualThanException(@Nullable final Throwable cause) {
77 super(DEFAULT_MESSAGE, cause);
78 }
79
80 }