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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
16 * TCP destination port match.
18 public class MatchTcpDestinationPort extends MatchInfoHelper<TcpMatch, TcpMatchBuilder> {
20 private final int port;
22 public MatchTcpDestinationPort(int port) {
27 protected void applyValue(MatchBuilder matchBuilder, TcpMatch value) {
28 matchBuilder.setLayer4Match(value);
32 protected void populateBuilder(TcpMatchBuilder builder) {
33 builder.setTcpDestinationPort(new PortNumber(port));
36 public int getPort() {
41 public boolean equals(Object other) {
45 if (other == null || getClass() != other.getClass()) {
48 if (!super.equals(other)) {
52 MatchTcpDestinationPort that = (MatchTcpDestinationPort) other;
54 return port == that.port;
58 public int hashCode() {
59 int result = super.hashCode();
60 result = 31 * result + port;
65 public String toString() {
66 return "MatchTcpDestinationPort[" + port + "]";