Six more Equals/HashCode/StringBuilder replacements
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetTpDst.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.sal.action;
11
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 /**
18  * Set destination transport port action
19  */
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22
23 public class SetTpDst extends Action {
24         @XmlElement
25     private int port;
26
27     /* Dummy constructor for JAXB */
28     private SetTpDst () {
29     }
30
31     public SetTpDst(int port) {
32         type = ActionType.SET_TP_DST;
33         this.port = port;
34         checkValue(port);
35     }
36
37     /**
38      * Returns the transport port the action will set
39      * @return
40      */
41     public int getPort() {
42         return port;
43     }
44
45     @Override
46     public boolean equals(Object obj) {
47         if (this == obj)
48             return true;
49         if (!super.equals(obj))
50             return false;
51         if (getClass() != obj.getClass())
52             return false;
53         SetTpDst other = (SetTpDst) obj;
54         if (port != other.port)
55             return false;
56         return true;
57     }
58
59     @Override
60     public int hashCode() {
61         final int prime = 31;
62         int result = super.hashCode();
63         result = prime * result + port;
64         return result;
65     }
66
67     @Override
68     public String toString() {
69         return type + "[port = " + port + "]";
70     }
71 }