1 package com.atlassian.plugin.util;
2
3
4
5
6 public class Assertions
7 {
8 public static <T> T notNull(final String name, final T notNull) throws IllegalArgumentException
9 {
10 if (notNull == null)
11 {
12 throw new NullArgumentException(name);
13 }
14 return notNull;
15 }
16
17 public static void isTrue(final String name, final boolean check) throws IllegalArgumentException
18 {
19 if (!check)
20 {
21 throw new IllegalArgumentException(name);
22 }
23 }
24
25 private Assertions()
26 {}
27
28 static class NullArgumentException extends IllegalArgumentException
29 {
30 private static final long serialVersionUID = 6178592463723624585L;
31
32 NullArgumentException(final String name)
33 {
34 super(name + " should not be null!");
35 }
36 }
37 }