tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net; |
2 | |||||
3 | import java.net.URI; | ||||
4 | |||||
5 | /** | ||||
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 6 | * Immutable representation of a device identity. |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 7 | */ |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame] | 8 | public final class DeviceId extends ElementId { |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 9 | |
Yuta HIGUCHI | 24a086b | 2014-09-21 23:28:41 -0700 | [diff] [blame] | 10 | // Default constructor for serialization |
11 | protected DeviceId() {} | ||||
12 | |||||
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame] | 13 | // Public construction is prohibited |
14 | private DeviceId(URI uri) { | ||||
15 | super(uri); | ||||
16 | } | ||||
17 | |||||
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 18 | /** |
tom | b36046e | 2014-08-27 00:22:24 -0700 | [diff] [blame] | 19 | * Creates a device id using the supplied URI. |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 20 | * |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame] | 21 | * @param uri device URI |
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 22 | */ |
tom | ca20e0c | 2014-09-03 23:22:24 -0700 | [diff] [blame] | 23 | public static DeviceId deviceId(URI uri) { |
24 | return new DeviceId(uri); | ||||
25 | } | ||||
26 | |||||
27 | /** | ||||
28 | * Creates a device id using the supplied URI string. | ||||
29 | * | ||||
30 | * @param string device URI string | ||||
31 | */ | ||||
32 | public static DeviceId deviceId(String string) { | ||||
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 33 | return deviceId(URI.create(string)); |
tom | 64b7aac | 2014-08-26 00:18:21 -0700 | [diff] [blame] | 34 | } |
35 | |||||
tom | 0eb04ca | 2014-08-25 14:34:51 -0700 | [diff] [blame] | 36 | } |