blob: 52fdf509a6db91eb6514250a6b995fef9b38d3a7 [file] [log] [blame]
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08001package net.floodlightcontroller.util;
2
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08003import org.codehaus.jackson.annotate.JsonProperty;
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08004
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08005/**
6 * The class representing a network port of a switch.
7 */
8public class Port {
9 private short value;
10
11 /**
12 * Default constructor.
13 */
14 public Port() {
15 this.value = 0;
16 }
17
18 /**
19 * Constructor from a long value.
20 *
21 * @param value the value to use.
22 */
23 public Port(short value) {
24 this.value = value;
25 }
26
27 /**
28 * Get the value of the port.
29 *
30 * @return the value of the port.
31 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080032 @JsonProperty("value")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080033 public short value() { return value; }
34
35 /**
36 * Set the value of the port.
37 *
38 * @param value the value to set.
39 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080040 @JsonProperty("value")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080041 public void setValue(short value) {
42 this.value = value;
43 }
44
45 /**
46 * Convert the port value to a string.
47 *
48 * @return the port value as a string.
49 */
50 @Override
51 public String toString() {
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080052 return Short.toString(this.value);
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080053 }
54}