*/
package org.opendaylight.openflowjava.protocol.api.keys;
+import static java.util.Objects.requireNonNull;
+
+import org.opendaylight.yangtools.yang.common.Uint8;
+
/**
* Key for a class type.
*
* @author michal.polkorab
*/
public class TypeToClassKey {
-
- private final short version;
+ private final Uint8 version;
private final int type;
/**
* @param version wire protocol version
* @param type message type / code
*/
- public TypeToClassKey(short version, int type) {
- this.version = version;
+ public TypeToClassKey(final Uint8 version, final int type) {
+ this.version = requireNonNull(version);
this.type = type;
}
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
return false;
}
TypeToClassKey other = (TypeToClassKey) obj;
- if (type != other.type) {
- return false;
- }
- if (version != other.version) {
- return false;
- }
- return true;
+ return type == other.type && version.equals(other.version);
}
}