blob: a0217d42225037b45b981c50702270705416d2eb [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) {
Jonathan Hart84198d32014-01-22 17:14:37 -080021 // Note: make a full copy if we change value to a mutable type
Jonathan Hart0444d932014-01-22 15:06:17 -080022 value = otherCallerId.value;
23 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080024
25 /**
26 * Constructor from a string value.
27 *
28 * @param value the value to use.
29 */
30 public CallerId(String value) {
31 this.value = value;
32 }
33
34 /**
35 * Get the value of the Caller ID.
36 *
37 * @return the value of the Caller ID.
38 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080039 @JsonProperty("value")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080040 public String value() { return value; }
41
42 /**
43 * Set the value of the Caller ID.
44 *
45 * @param value the value to set.
46 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080047 @JsonProperty("value")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080048 public void setValue(String value) {
49 this.value = value;
50 }
51
52 /**
53 * Convert the Caller ID value to a string.
54 *
55 * @return the Caller ID value to a string.
56 */
57 @Override
58 public String toString() {
59 return value;
60 }
Jonathan Hart0444d932014-01-22 15:06:17 -080061
62 @Override
63 public boolean equals(Object other) {
64 if (!(other instanceof CallerId)) {
65 return false;
66 }
67
68 CallerId otherCallerId = (CallerId) other;
69
70 return value.equals(otherCallerId.value);
71 }
72
73 @Override
74 public int hashCode() {
75 return value.hashCode();
76 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080077}