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;
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 @@ public class DeviceEvent extends AbstractEvent<DeviceEvent.Type, Device> {
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();
}
}
......