REST API to create flows
Change-Id: I5d001782249c0eab249d7aa857ae465da95b5955
diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java
index 73c8802..0e23dbf 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -123,7 +123,7 @@
}
/**
- * Returns the specified item if that items is null; otherwise throws
+ * Returns the specified item if that item is not null; otherwise throws
* not found exception.
*
* @param item item to check
@@ -140,6 +140,23 @@
}
/**
+ * Returns the specified item if that item is not null; otherwise throws
+ * bad argument exception.
+ *
+ * @param item item to check
+ * @param message not found message
+ * @param <T> item type
+ * @return item if not null
+ * @throws IllegalArgumentException if item is null
+ */
+ public static <T> T nullIsIllegal(T item, String message) {
+ if (item == null) {
+ throw new IllegalArgumentException(message);
+ }
+ return item;
+ }
+
+ /**
* Converts a string from hex to long.
*
* @param string hex number in string form; sans 0x