aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2016-06-29 00:17:11 +0200
committerRoel Spilker <r.spilker@gmail.com>2016-06-29 00:17:11 +0200
commit6d720cbf99021b71ae9d2918168561db2223b030 (patch)
tree940dab3331fa19aa55e989f3ec1ecf84a6af7a8d /src/core/lombok
parent26ebe6aaa8838c3bb6d7be4836216bcc4030f2b1 (diff)
downloadlombok-6d720cbf99021b71ae9d2918168561db2223b030.tar.gz
lombok-6d720cbf99021b71ae9d2918168561db2223b030.tar.bz2
lombok-6d720cbf99021b71ae9d2918168561db2223b030.zip
add checkNotNull to Lombok for future usage in super constructor call
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/Lombok.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/lombok/Lombok.java b/src/core/lombok/Lombok.java
index 07fd083d..164c47a8 100644
--- a/src/core/lombok/Lombok.java
+++ b/src/core/lombok/Lombok.java
@@ -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;
+ }
}