HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.util; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 2 | |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 3 | import org.codehaus.jackson.annotate.JsonProperty; |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 4 | |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 5 | /** |
| 6 | * The class representing a Caller ID for an ONOS component. |
| 7 | */ |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 8 | public class CallerId { |
| 9 | private String value; |
| 10 | |
| 11 | /** |
| 12 | * Default constructor. |
| 13 | */ |
| 14 | public CallerId() {} |
Jonathan Hart | 0444d93 | 2014-01-22 15:06:17 -0800 | [diff] [blame^] | 15 | |
| 16 | /** |
| 17 | * Copy constructor |
| 18 | * @param otherCallerId |
| 19 | */ |
| 20 | public CallerId(CallerId otherCallerId) { |
| 21 | value = otherCallerId.value; |
| 22 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 23 | |
| 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 Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 38 | @JsonProperty("value") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 39 | 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 Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 46 | @JsonProperty("value") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 47 | 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 Hart | 0444d93 | 2014-01-22 15:06:17 -0800 | [diff] [blame^] | 60 | |
| 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 Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 76 | } |