Override toString for flow objectives
Change-Id: I725ca9ac231e21c12f364e1a8bbdc6d3cd1e5a38
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
index 593cde6..83c8d1f 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java
@@ -27,6 +27,7 @@
import java.util.Objects;
import java.util.Optional;
+import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -120,7 +121,6 @@
return context;
}
-
@Override
public int hashCode() {
return Objects.hash(type, permanent, timeout, appId, priority, key,
@@ -147,6 +147,23 @@
return false;
}
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id())
+ .add("type", type())
+ .add("op", op())
+ .add("priority", priority())
+ .add("key", key())
+ .add("conditions", conditions())
+ .add("meta", meta())
+ .add("appId", appId())
+ .add("permanent", permanent())
+ .add("timeout", timeout())
+ .add("context", context())
+ .toString();
+ }
+
/**
* Returns a new builder.
*
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
index 7c442b2..fd08fd4 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java
@@ -24,6 +24,7 @@
import java.util.Objects;
import java.util.Optional;
+import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -146,6 +147,23 @@
return false;
}
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id())
+ .add("op", op())
+ .add("priority", priority())
+ .add("selector", selector())
+ .add("treatment", treatment())
+ .add("nextId", nextId())
+ .add("flag", flag())
+ .add("appId", appId())
+ .add("permanent", permanent())
+ .add("timeout", timeout())
+ .add("context", context())
+ .toString();
+ }
+
/**
* Returns a new builder.
*
diff --git a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
index 8010659..01a6f0d 100644
--- a/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
+++ b/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java
@@ -26,6 +26,7 @@
import java.util.Objects;
import java.util.Optional;
+import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -125,6 +126,22 @@
return false;
}
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("id", id())
+ .add("type", type())
+ .add("op", op())
+ .add("priority", priority())
+ .add("next", next())
+ .add("meta", meta())
+ .add("appId", appId())
+ .add("permanent", permanent())
+ .add("timeout", timeout())
+ .add("context", context())
+ .toString();
+ }
+
/**
* Returns a new builder.
*