Added method DeviceEvent.toString() that overrides method
AbstractEvent.toString()
This method is needed so we can display the port as well (when set).
Change-Id: I35af68ccb4a63602de40a904a6cee0cfe5f4985f
diff --git a/core/api/src/main/java/org/onlab/onos/net/device/DeviceEvent.java b/core/api/src/main/java/org/onlab/onos/net/device/DeviceEvent.java
index 0a33777..07bd426 100644
--- a/core/api/src/main/java/org/onlab/onos/net/device/DeviceEvent.java
+++ b/core/api/src/main/java/org/onlab/onos/net/device/DeviceEvent.java
@@ -4,6 +4,8 @@
import org.onlab.onos.net.Device;
import org.onlab.onos.net.Port;
+import static com.google.common.base.MoreObjects.toStringHelper;
+
/**
* Describes infrastructure device event.
*/
@@ -109,4 +111,12 @@
return port;
}
+ @Override
+ public String toString() {
+ if (port == null) {
+ return super.toString();
+ }
+ return toStringHelper(this).add("time", time()).add("type", type())
+ .add("subject", subject()).add("port", port).toString();
+ }
}