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 than another object but was
23 * not.
24 *
25 * @author André Rouél
26 * @author Dominik Seichter
27 */
28 public class IllegalNotGreaterThanException extends RuntimeException {
29
30 private static final long serialVersionUID = 49779498587504287L;
31
32 /**
33 * Default message to indicate that the given arguments must be greater then another object.
34 */
35 protected static final String DEFAULT_MESSAGE = "Argument must be greater than a defined value.";
36
37 /**
38 * Constructs an {@code IllegalNotGreaterThanException} with the default message
39 * {@link IllegalNotGreaterThanException#DEFAULT_MESSAGE}.
40 */
41 public IllegalNotGreaterThanException() {
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 IllegalNotGreaterThanException(@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 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 IllegalNotGreaterThanException(@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 IllegalNotGreaterThanException#DEFAULT_MESSAGE}.
70 *
71 * @param cause
72 * the cause (which is saved for later retrieval by the {@link Throwable#getCause()} method). (A
73 * {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.)
74 */
75 public IllegalNotGreaterThanException(@Nullable final Throwable cause) {
76 super(DEFAULT_MESSAGE, cause);
77 }
78
79 }