Cleaning up and enhancing driver subsystem and the flow objective subsystem.
Change-Id: Ica600ef1aaa46d19e764cd7a197454a4e0f85a08
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 b788038..01dda9e 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -112,6 +112,23 @@
}
/**
+ * Returns the specified item if that items is null; otherwise throws
+ * not found exception.
+ *
+ * @param item item to check
+ * @param message not found message
+ * @param <T> item type
+ * @return item if not null
+ * @throws org.onlab.util.ItemNotFoundException if item is null
+ */
+ public static <T> T nullIsNotFound(T item, String message) {
+ if (item == null) {
+ throw new ItemNotFoundException(message);
+ }
+ return item;
+ }
+
+ /**
* Converts a string from hex to long.
*
* @param string hex number in string form; sans 0x