Offload null value checking to CodeHelpers
[mdsal.git] / binding / yang-binding / src / main / java / org / opendaylight / yangtools / yang / binding / CodeHelpers.java
index 774ee6cdebc81740ffdec6e4e3c1b9882b8498ad..a3fde03a2fe6632458e64ebc3e51ac96b71e69d3 100644 (file)
@@ -67,6 +67,16 @@ public final class CodeHelpers {
         return value;
     }
 
+    /**
+     * A shortcut for {@code Objects.requireNonNull(value, "Supplied value may not be null")}.
+     *
+     * @param value Value itself
+     * @throws NullPointerException if value is null
+     */
+    public static void requireValue(@Nullable final Object value) {
+        requireNonNull(value, "Supplied value may not be null");
+    }
+
     /**
      * Append a named value to a ToStringHelper. If the value is null, this method does nothing.
      *