/**
* Abstract base class for InstructionInfo implementations, to enforce
- * implementation of equals(), hashCode() and toString.
- *
- * @author Michael Vorburger.ch
+ * implementation of equals(), hashCode() and toString().
*/
/* can remain package local instead of public (unless there are InstructionInfo impls elsewhere?) */
abstract class AbstractInstructionInfoImpl implements InstructionInfo {
@Override
- public final boolean equals(Object obj) {
- return equals2(obj);
- }
+ public abstract boolean equals(Object other);
@Override
- public final int hashCode() {
- return hashCode2();
- }
+ public abstract int hashCode();
@Override
- public String toString() {
- return toString2();
- }
-
- protected abstract boolean equals2(Object other);
-
- protected abstract int hashCode2();
+ public abstract String toString();
- protected abstract String toString2();
}
package org.opendaylight.genius.mdsalutil.instructions;
import java.util.List;
-import java.util.Objects;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.ActionInfoList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
-import org.opendaylight.yangtools.util.EvenMoreObjects;
/**
* Apply actions instruction.
}
@Override
- protected boolean equals2(Object obj) {
- return EvenMoreObjects.equalsHelper(this, obj,
- (self, other) -> Objects.equals(self.actions, other.actions));
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
+
+ InstructionApplyActions that = (InstructionApplyActions) other;
+
+ return actions.equals(that.actions);
}
@Override
- protected int hashCode2() {
- return Objects.hash(actions);
+ public int hashCode() {
+ return actions.hashCode();
}
@Override
- protected String toString2() {
+ public String toString() {
return "InstructionApplyActions[" + actions + "]";
}
}
}
@Override
- public boolean equals2(Object other) {
+ public boolean equals(Object other) {
if (this == other) {
return true;
}
}
@Override
- public int hashCode2() {
+ public int hashCode() {
return 17;
}
@Override
- protected String toString2() {
+ public String toString() {
return "InstructionClearActions";
}
}
}
@Override
- public boolean equals2(Object other) {
+ public boolean equals(Object other) {
if (this == other) {
return true;
}
}
@Override
- public int hashCode2() {
+ public int hashCode() {
return tableId;
}
@Override
- protected String toString2() {
+ public String toString() {
return "InstructionGotoTable[" + tableId + "]";
}
}
package org.opendaylight.genius.mdsalutil.instructions;
import java.util.List;
-import java.util.Objects;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.ActionInfoList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
-import org.opendaylight.yangtools.util.EvenMoreObjects;
/**
* Write actions instruction.
}
@Override
- protected boolean equals2(Object obj) {
- return EvenMoreObjects.equalsHelper(this, obj,
- (self, other) -> Objects.equals(self.actions, other.actions));
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
+
+ InstructionWriteActions that = (InstructionWriteActions) other;
+
+ return actions.equals(that.actions);
}
@Override
- protected int hashCode2() {
- return Objects.hash(actions);
+ public int hashCode() {
+ return actions.hashCode();
}
@Override
- protected String toString2() {
+ public String toString() {
return "InstructionWriteActions[" + actions + "]";
}
}
@Override
- public boolean equals2(Object other) {
+ public boolean equals(Object other) {
if (this == other) {
return true;
}
}
@Override
- public int hashCode2() {
+ public int hashCode() {
int result = metadata != null ? metadata.hashCode() : 0;
result = 31 * result + (mask != null ? mask.hashCode() : 0);
return result;
}
@Override
- protected String toString2() {
+ public String toString() {
return "InstructionWriteMetadata[metadata=" + metadata + ", mask=" + mask + "]";
}
}