2 * Copyright (c) 2014 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.api.keys;
11 import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
12 import org.opendaylight.openflowjava.protocol.api.keys.experimenter.ExperimenterSerializerKey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
18 * @author michal.polkorab
19 * @param <OXM_CLASS> oxm_class (see specification)
20 * @param <OXM_FIELD> oxm_field (see specification)
22 public final class MatchEntrySerializerKey<OXM_CLASS extends OxmClassBase, OXM_FIELD extends MatchField>
23 extends MessageTypeKey<MatchEntries> implements ExperimenterSerializerKey {
25 private Class<OXM_CLASS> oxmClass;
26 private Class<OXM_FIELD> oxmField;
27 private Long experimenterId;
30 * @param msgVersion protocol wire version
31 * @param objectType class of serialized object
32 * @param oxmClass oxm_class (see specification)
33 * @param oxmField oxm_field (see specification)
35 public MatchEntrySerializerKey(short msgVersion, Class<OXM_CLASS> oxmClass,
36 Class<OXM_FIELD> oxmField) {
37 super(msgVersion, MatchEntries.class);
38 this.oxmClass = oxmClass;
39 this.oxmField = oxmField;
43 * @param experimenterId experimenter / vendor ID
45 public void setExperimenterId(Long experimenterId) {
46 this.experimenterId = experimenterId;
50 public int hashCode() {
52 int result = super.hashCode();
53 result = prime * result + ((experimenterId == null) ? 0 : experimenterId.hashCode());
54 result = prime * result + ((oxmClass == null) ? 0 : oxmClass.hashCode());
55 result = prime * result + ((oxmField == null) ? 0 : oxmField.hashCode());
60 public boolean equals(Object obj) {
64 if (!super.equals(obj)) {
67 if (getClass() != obj.getClass()) {
70 MatchEntrySerializerKey<?, ?> other = (MatchEntrySerializerKey<?, ?>) obj;
71 if (experimenterId == null) {
72 if (other.experimenterId != null) {
75 } else if (!experimenterId.equals(other.experimenterId)) {
78 if (oxmClass == null) {
79 if (other.oxmClass != null) {
82 } else if (!oxmClass.equals(other.oxmClass)) {
85 if (oxmField == null) {
86 if (other.oxmField != null) {
89 } else if (!oxmField.equals(other.oxmField)) {
96 public String toString() {
97 return super.toString() + " oxm_class: " + oxmClass.getName() + " oxm_field: "
98 + oxmField.getName() + " experimenterID: " + experimenterId;