Finalize Match/Action Objects - ONOS-1728
* Added equals() and hashCode() methods to objects with IDs
* Added/Updates Javadocs
* Implemented rudimentary execute and query methods for
Operations in the MatchActionModule. Operations are preserved
but not actually executed currently.
* Implemented factories for MatchActionOperationsId and
MatchActionOperations
* Added unit tests to check creation and execution of MatchAction
* Added unit tests for new Immutable classes
Change-Id: Id865d04fd1048d00e533736c95c3052148041d95
diff --git a/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java b/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java
index 7c3a22d..24790b8 100644
--- a/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java
+++ b/src/main/java/net/onrc/onos/core/matchaction/MatchAction.java
@@ -8,7 +8,7 @@
import net.onrc.onos.core.util.SwitchPort;
/**
- * A filter and actions for traffic.
+ * A filter and actions for traffic. Objects of this class are immutable.
*/
public final class MatchAction implements BatchOperationTarget {
private final MatchActionId id;
@@ -66,4 +66,18 @@
public List<Action> getActions() {
return actions;
}
+
+ @Override
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof MatchAction) {
+ MatchAction other = (MatchAction) obj;
+ return (id.equals(other.id));
+ }
+ return false;
+ }
}