blob: ec18f09c0ec43ef56f6d9ccf5a198e1c3c937c20 [file] [log] [blame]
HIGUCHI Yuta356086e2013-06-12 15:21:19 -07001package net.onrc.onos.ofcontroller.util;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08002
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 Caller ID for an ONOS component.
7 */
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08008public class CallerId {
9 private String value;
10
11 /**
12 * Default constructor.
13 */
14 public CallerId() {}
Jonathan Hart0444d932014-01-22 15:06:17 -080015
16 /**
17 * Copy constructor
18 * @param otherCallerId
19 */
20 public CallerId(CallerId otherCallerId) {
21 value = otherCallerId.value;
22 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080023
24 /**
25 * Constructor from a string value.
26 *
27 * @param value the value to use.
28 */
29 public CallerId(String value) {
30 this.value = value;
31 }
32
33 /**
34 * Get the value of the Caller ID.
35 *
36 * @return the value of the Caller ID.
37 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080038 @JsonProperty("value")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080039 public String value() { return value; }
40
41 /**
42 * Set the value of the Caller ID.
43 *
44 * @param value the value to set.
45 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080046 @JsonProperty("value")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080047 public void setValue(String value) {
48 this.value = value;
49 }
50
51 /**
52 * Convert the Caller ID value to a string.
53 *
54 * @return the Caller ID value to a string.
55 */
56 @Override
57 public String toString() {
58 return value;
59 }
Jonathan Hart0444d932014-01-22 15:06:17 -080060
61 @Override
62 public boolean equals(Object other) {
63 if (!(other instanceof CallerId)) {
64 return false;
65 }
66
67 CallerId otherCallerId = (CallerId) other;
68
69 return value.equals(otherCallerId.value);
70 }
71
72 @Override
73 public int hashCode() {
74 return value.hashCode();
75 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080076}