BUG 2302 : odl-clustering-test-app should not be part of the odl-restconf-all feature set
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / action / SetTpSrc.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.sal.action;
10
11 import javax.xml.bind.annotation.XmlAccessType;
12 import javax.xml.bind.annotation.XmlAccessorType;
13 import javax.xml.bind.annotation.XmlElement;
14 import javax.xml.bind.annotation.XmlRootElement;
15
16 /**
17  * Set source transport port action
18  *
19  */
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public class SetTpSrc extends Action {
23     private static final long serialVersionUID = 1L;
24     @XmlElement
25     private int port;
26
27     /* Dummy constructor for JAXB */
28     @SuppressWarnings("unused")
29     private SetTpSrc() {
30     }
31
32     public SetTpSrc(int port) {
33         type = ActionType.SET_TP_SRC;
34         this.port = port;
35         checkValue(port);
36     }
37
38     /**
39      * Returns the transport port the action will set
40      *
41      * @return
42      */
43     public int getPort() {
44         return port;
45     }
46
47     @Override
48     public boolean equals(Object obj) {
49         if (this == obj) {
50             return true;
51         }
52         if (!super.equals(obj)) {
53             return false;
54         }
55         if (getClass() != obj.getClass()) {
56             return false;
57         }
58         SetTpSrc other = (SetTpSrc) obj;
59         if (port != other.port) {
60             return false;
61         }
62         return true;
63     }
64
65     @Override
66     public int hashCode() {
67         final int prime = 31;
68         int result = super.hashCode();
69         result = prime * result + port;
70         return result;
71     }
72
73     @Override
74     public String toString() {
75         return type + "[port = " + port + "]";
76     }
77 }