774c79a543feacae6b59e052c04326311f31cd0c
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / action / Output.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 import org.opendaylight.controller.sal.core.NodeConnector;
18
19 /**
20  * Represents the action of sending the packet out of a physical port
21  *
22  *
23  *
24  */
25 @XmlRootElement
26 @XmlAccessorType(XmlAccessType.NONE)
27
28 public class Output extends Action {
29         @XmlElement
30     private NodeConnector port;
31
32     /* Dummy constructor for JAXB */
33     private Output () {
34     }
35
36     public Output(NodeConnector port) {
37         type = ActionType.OUTPUT;
38         this.port = port;
39         //checkValue(port);
40     }
41
42     public NodeConnector getPort() {
43         return port;
44     }
45
46     @Override
47     public boolean equals(Object obj) {
48         if (this == obj)
49             return true;
50         if (!super.equals(obj))
51             return false;
52         if (getClass() != obj.getClass())
53             return false;
54         Output other = (Output) obj;
55         if (port == null) {
56             if (other.port != null)
57                 return false;
58         } else if (!port.equals(other.port))
59             return false;
60         return true;
61     }
62
63     @Override
64     public int hashCode() {
65         final int prime = 31;
66         int result = super.hashCode();
67         result = prime * result + ((port == null) ? 0 : port.hashCode());
68         return result;
69     }
70
71     @Override
72     public String toString() {
73         return type + "[" + port.toString() + "]";
74     }
75 }