2 * Copyright © 2017 Red Hat, Inc. and others.
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
8 package org.opendaylight.genius.mdsalutil.matches;
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatch;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
17 * VLAN identifier match.
19 public class MatchVlanVid extends MatchInfoHelper<VlanMatch, VlanMatchBuilder> {
21 private final int vlanId;
23 public MatchVlanVid(int vlanId) {
28 protected void applyValue(MatchBuilder matchBuilder, VlanMatch value) {
29 matchBuilder.setVlanMatch(value);
33 protected void populateBuilder(VlanMatchBuilder builder) {
34 builder.setVlanId(new VlanIdBuilder()
35 .setVlanId(new VlanId(vlanId))
36 .setVlanIdPresent(vlanId != 0)
40 public int getVlanId() {
45 public boolean equals(Object other) {
49 if (other == null || getClass() != other.getClass()) {
52 if (!super.equals(other)) {
56 MatchVlanVid that = (MatchVlanVid) other;
58 return vlanId == that.vlanId;
62 public int hashCode() {
63 int result = super.hashCode();
64 result = 31 * result + vlanId;
69 public String toString() {
70 return "MatchVlanVid[" + vlanId + "]";