Pavlin Radoslavov

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
...@@ -4,6 +4,8 @@ import org.onlab.onos.event.AbstractEvent; ...@@ -4,6 +4,8 @@ import org.onlab.onos.event.AbstractEvent;
4 import org.onlab.onos.net.Device; 4 import org.onlab.onos.net.Device;
5 import org.onlab.onos.net.Port; 5 import org.onlab.onos.net.Port;
6 6
7 +import static com.google.common.base.MoreObjects.toStringHelper;
8 +
7 /** 9 /**
8 * Describes infrastructure device event. 10 * Describes infrastructure device event.
9 */ 11 */
...@@ -109,4 +111,12 @@ public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> { ...@@ -109,4 +111,12 @@ public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> {
109 return port; 111 return port;
110 } 112 }
111 113
114 + @Override
115 + public String toString() {
116 + if (port == null) {
117 + return super.toString();
118 + }
119 + return toStringHelper(this).add("time", time()).add("type", type())
120 + .add("subject", subject()).add("port", port).toString();
121 + }
112 } 122 }
......