Update BatchOperation class to be more generic and extensible.
- addAddOperation() and addRemoveOperation() methods are removed
from BatchOperation class, and now the class has just addOperation() method.
- Removed AddOperation and RemoveOperation classes,
and defined IntentBatchOperation, FlowBatchOperation and MatchActionPhase classes
as sub-classes of BatchOperation class, for Intent, IFlow and MatchAction objects
respectively.
- These classes include definitions of add/remove operators and helper methods
specific to Intent, IFlow and MatchAction objects.
- Removed BatchOperationTargetId class.
- Updated unit tests.
- This task is a part of ONOS-1692.
Change-Id: Iba2f737af1fef6a6555e0e0166836865ed070fa3
diff --git a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java
index 7274d5f..23b3e39 100644
--- a/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java
+++ b/src/main/java/net/onrc/onos/api/batchoperation/BatchOperationEntry.java
@@ -1,16 +1,41 @@
package net.onrc.onos.api.batchoperation;
/**
- * An interface for batch operation entry classes.
+ * A super class for batch operation entry classes.
* <p>
- * This is the interface to AddOperation, UpdateOperation and RemoveOperation
- * classes which are the entry maintained by BatchOperation.
+ * This is the interface to classes which are maintained by BatchOperation as
+ * its entries.
*/
-public interface BatchOperationEntry<T extends IBatchOperationTarget> {
+public class BatchOperationEntry<T extends Enum<?>, U extends IBatchOperationTarget> {
+ private final T operator;
+ private final U target;
+
/**
- * Gets the BatchOperator of this operation.
+ * Constructs new instance for the entry of the BatchOperation.
*
- * @return the BatchOperator of this operation
+ * @param operator the operator of this operation
+ * @param target the target object of this operation
*/
- public BatchOperator getOperator();
+ public BatchOperationEntry(T operator, U target) {
+ this.operator = operator;
+ this.target = target;
+ }
+
+ /**
+ * Gets the target object of this operation.
+ *
+ * @return the target object of this operation
+ */
+ public U getTarget() {
+ return target;
+ }
+
+ /**
+ * Gets the operator of this operation.
+ *
+ * @return the operator of this operation
+ */
+ public T getOperator() {
+ return operator;
+ }
}