jcc | fff0de9 | 2015-03-28 01:40:08 -0700 | [diff] [blame] | 1 | package org.onosproject.net.resource; |
| 2 | |
| 3 | import java.util.Objects; |
| 4 | |
| 5 | /** |
| 6 | * Representation of a label. |
| 7 | */ |
| 8 | public final class LabelResourceId implements ResourceId { |
| 9 | |
| 10 | private long labelId; |
| 11 | |
| 12 | public static LabelResourceId labelResourceId(long labelResourceId) { |
| 13 | return new LabelResourceId(labelResourceId); |
| 14 | } |
| 15 | |
| 16 | // Public construction is prohibited |
| 17 | private LabelResourceId(long labelId) { |
| 18 | this.labelId = labelId; |
| 19 | } |
| 20 | |
| 21 | public long labelId() { |
| 22 | return labelId; |
| 23 | } |
| 24 | |
| 25 | @Override |
| 26 | public int hashCode() { |
| 27 | return Objects.hashCode(labelId); |
| 28 | } |
| 29 | |
| 30 | @Override |
| 31 | public boolean equals(Object obj) { |
| 32 | if (obj instanceof LabelResourceId) { |
| 33 | LabelResourceId that = (LabelResourceId) obj; |
| 34 | return Objects.equals(this.labelId, that.labelId); |
| 35 | } |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public String toString() { |
| 41 | return String.valueOf(this.labelId); |
| 42 | } |
| 43 | |
| 44 | } |