blob: 0bfb07a6a1636b740d962183efe7eeda6b434747 [file] [log] [blame]
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08001package net.floodlightcontroller.util;
2
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08003import net.floodlightcontroller.util.serializers.PortSerializer;
4
5import org.codehaus.jackson.annotate.JsonProperty;
6import org.codehaus.jackson.map.annotate.JsonSerialize;
7
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08008/**
9 * The class representing a network port of a switch.
10 */
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080011@JsonSerialize(using=PortSerializer.class)
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080012public class Port {
13 private short value;
14
15 /**
16 * Default constructor.
17 */
18 public Port() {
19 this.value = 0;
20 }
21
22 /**
23 * Constructor from a long value.
24 *
25 * @param value the value to use.
26 */
27 public Port(short value) {
28 this.value = value;
29 }
30
31 /**
32 * Get the value of the port.
33 *
34 * @return the value of the port.
35 */
36 public short value() { return value; }
37
38 /**
39 * Set the value of the port.
40 *
41 * @param value the value to set.
42 */
43 public void setValue(short value) {
44 this.value = value;
45 }
46
47 /**
48 * Convert the port value to a string.
49 *
50 * @return the port value as a string.
51 */
52 @Override
53 public String toString() {
Pavlin Radoslavovad008e02013-02-21 18:42:42 -080054 return Short.toString(this.value);
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080055 }
56}