blob: 8d96d8b590bcda3e49a2cae48e5e66a6797bb04b [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001package org.onlab.onos.net;
2
3import java.net.URI;
4
5/**
tom64b7aac2014-08-26 00:18:21 -07006 * Immutable representation of a device identity.
tom0eb04ca2014-08-25 14:34:51 -07007 */
tomca20e0c2014-09-03 23:22:24 -07008public final class DeviceId extends ElementId {
tom0eb04ca2014-08-25 14:34:51 -07009
Yuta HIGUCHI24a086b2014-09-21 23:28:41 -070010 // Default constructor for serialization
11 protected DeviceId() {}
12
tomca20e0c2014-09-03 23:22:24 -070013 // Public construction is prohibited
14 private DeviceId(URI uri) {
15 super(uri);
16 }
17
tom0eb04ca2014-08-25 14:34:51 -070018 /**
tomb36046e2014-08-27 00:22:24 -070019 * Creates a device id using the supplied URI.
tom0eb04ca2014-08-25 14:34:51 -070020 *
tomca20e0c2014-09-03 23:22:24 -070021 * @param uri device URI
tom0eb04ca2014-08-25 14:34:51 -070022 */
tomca20e0c2014-09-03 23:22:24 -070023 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) {
tom568581d2014-09-08 20:13:36 -070033 return deviceId(URI.create(string));
tom64b7aac2014-08-26 00:18:21 -070034 }
35
tom0eb04ca2014-08-25 14:34:51 -070036}