mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 16:17:34 +00:00
add checkNotNull to Lombok for future usage in super constructor call
This commit is contained in:
1 parent
26ebe6aaa8
commit
6d720cbf99
1 file changed
+12
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user