Fix CodeHelper.nonnull() nullness annotation
[mdsal.git] / binding / yang-binding / src / main / java / org / opendaylight / yangtools / yang / binding / CodeHelpers.java
index 774ee6cdebc81740ffdec6e4e3c1b9882b8498ad..0356fe5cba1a043ec3dbbbbf93d8fd9fd29c4232 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.
      *
@@ -75,7 +85,7 @@ public final class CodeHelpers {
      * @param value Value to append
      * @throws NullPointerException if the name or helper is null
      */
-    public static void appendValue(final @NonNull ToStringHelper helper, final @NonNull String name,
+    public static void appendValue(final ToStringHelper helper, final @NonNull String name,
             final @Nullable Object value) {
         if (value != null) {
             helper.add(name, value);
@@ -227,7 +237,7 @@ public final class CodeHelpers {
      * @param input input list, may be null
      * @return Input list or an empty list.
      */
-    public static <T> List<T> nonnull(final @Nullable List<T> input) {
+    public static <T> @NonNull List<T> nonnull(final @Nullable List<T> input) {
         return input != null ? input : ImmutableList.of();
     }