add checkNotNull to Lombok for future usage in super constructor call

This commit is contained in:
Roel Spilker committed 2016-06-29 00:17:11 +02:00
1 parent 26ebe6aaa8
commit 6d720cbf99
1 file changed
+12
+12
View File
@@ -71,4 +71,16 @@ public class Lombok {
public static <T> T preventNullAnalysis(T value) {
return value;
}
/**
* Ensures that the {@code value} is not {@code null}.
* @param value the value to test for null
* @param message the message of the {@link NullPointerException}
* @return the value if it is not null
* @throws NullPointerException with the {@code message} if the value is null
*/
public static <T> T checkNotNull(T value, String message) {
if (value == null) throw new NullPointerException(message);
return value;
}
}