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