Charles Chan
Committed by Gerrit Code Review

Override toString for flow objectives

Change-Id: I725ca9ac231e21c12f364e1a8bbdc6d3cd1e5a38
...@@ -27,6 +27,7 @@ import java.util.List; ...@@ -27,6 +27,7 @@ import java.util.List;
27 import java.util.Objects; 27 import java.util.Objects;
28 import java.util.Optional; 28 import java.util.Optional;
29 29
30 +import static com.google.common.base.MoreObjects.toStringHelper;
30 import static com.google.common.base.Preconditions.checkArgument; 31 import static com.google.common.base.Preconditions.checkArgument;
31 import static com.google.common.base.Preconditions.checkNotNull; 32 import static com.google.common.base.Preconditions.checkNotNull;
32 33
...@@ -120,7 +121,6 @@ public final class DefaultFilteringObjective implements FilteringObjective { ...@@ -120,7 +121,6 @@ public final class DefaultFilteringObjective implements FilteringObjective {
120 return context; 121 return context;
121 } 122 }
122 123
123 -
124 @Override 124 @Override
125 public int hashCode() { 125 public int hashCode() {
126 return Objects.hash(type, permanent, timeout, appId, priority, key, 126 return Objects.hash(type, permanent, timeout, appId, priority, key,
...@@ -147,6 +147,23 @@ public final class DefaultFilteringObjective implements FilteringObjective { ...@@ -147,6 +147,23 @@ public final class DefaultFilteringObjective implements FilteringObjective {
147 return false; 147 return false;
148 } 148 }
149 149
150 + @Override
151 + public String toString() {
152 + return toStringHelper(this)
153 + .add("id", id())
154 + .add("type", type())
155 + .add("op", op())
156 + .add("priority", priority())
157 + .add("key", key())
158 + .add("conditions", conditions())
159 + .add("meta", meta())
160 + .add("appId", appId())
161 + .add("permanent", permanent())
162 + .add("timeout", timeout())
163 + .add("context", context())
164 + .toString();
165 + }
166 +
150 /** 167 /**
151 * Returns a new builder. 168 * Returns a new builder.
152 * 169 *
......
...@@ -24,6 +24,7 @@ import org.onosproject.net.flow.TrafficTreatment; ...@@ -24,6 +24,7 @@ import org.onosproject.net.flow.TrafficTreatment;
24 import java.util.Objects; 24 import java.util.Objects;
25 import java.util.Optional; 25 import java.util.Optional;
26 26
27 +import static com.google.common.base.MoreObjects.toStringHelper;
27 import static com.google.common.base.Preconditions.checkArgument; 28 import static com.google.common.base.Preconditions.checkArgument;
28 import static com.google.common.base.Preconditions.checkNotNull; 29 import static com.google.common.base.Preconditions.checkNotNull;
29 30
...@@ -146,6 +147,23 @@ public final class DefaultForwardingObjective implements ForwardingObjective { ...@@ -146,6 +147,23 @@ public final class DefaultForwardingObjective implements ForwardingObjective {
146 return false; 147 return false;
147 } 148 }
148 149
150 + @Override
151 + public String toString() {
152 + return toStringHelper(this)
153 + .add("id", id())
154 + .add("op", op())
155 + .add("priority", priority())
156 + .add("selector", selector())
157 + .add("treatment", treatment())
158 + .add("nextId", nextId())
159 + .add("flag", flag())
160 + .add("appId", appId())
161 + .add("permanent", permanent())
162 + .add("timeout", timeout())
163 + .add("context", context())
164 + .toString();
165 + }
166 +
149 /** 167 /**
150 * Returns a new builder. 168 * Returns a new builder.
151 * 169 *
......
...@@ -26,6 +26,7 @@ import java.util.List; ...@@ -26,6 +26,7 @@ import java.util.List;
26 import java.util.Objects; 26 import java.util.Objects;
27 import java.util.Optional; 27 import java.util.Optional;
28 28
29 +import static com.google.common.base.MoreObjects.toStringHelper;
29 import static com.google.common.base.Preconditions.checkArgument; 30 import static com.google.common.base.Preconditions.checkArgument;
30 import static com.google.common.base.Preconditions.checkNotNull; 31 import static com.google.common.base.Preconditions.checkNotNull;
31 32
...@@ -125,6 +126,22 @@ public final class DefaultNextObjective implements NextObjective { ...@@ -125,6 +126,22 @@ public final class DefaultNextObjective implements NextObjective {
125 return false; 126 return false;
126 } 127 }
127 128
129 + @Override
130 + public String toString() {
131 + return toStringHelper(this)
132 + .add("id", id())
133 + .add("type", type())
134 + .add("op", op())
135 + .add("priority", priority())
136 + .add("next", next())
137 + .add("meta", meta())
138 + .add("appId", appId())
139 + .add("permanent", permanent())
140 + .add("timeout", timeout())
141 + .add("context", context())
142 + .toString();
143 + }
144 +
128 /** 145 /**
129 * Returns a new builder. 146 * Returns a new builder.
130 * 147 *
......