blob: b3d920be214e69c4220b9469d87921930d2a083b [file] [log] [blame]
Thomas Vachuska7b438af2015-07-07 09:52:07 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.incubator.net.virtual;
17
18import com.google.common.annotations.Beta;
Jian Lib6d998e2016-02-29 11:41:18 -080019import org.onlab.util.Identifier;
Thomas Vachuska7b438af2015-07-07 09:52:07 -070020
21/**
22 * Representation of network identity.
23 */
24@Beta
Jian Lib6d998e2016-02-29 11:41:18 -080025public final class NetworkId extends Identifier<Long> {
Thomas Vachuska7b438af2015-07-07 09:52:07 -070026
27 /**
28 * Represents no network, or an unspecified network.
29 */
30 public static final NetworkId NONE = networkId(-1L);
31
32 /**
33 * Represents the underlying physical network.
34 */
35 public static final NetworkId PHYSICAL = networkId(0L);
36
Thomas Vachuska7b438af2015-07-07 09:52:07 -070037 // Public construction is prohibited
38 private NetworkId(long id) {
Jian Lib6d998e2016-02-29 11:41:18 -080039 super(id);
Thomas Vachuska7b438af2015-07-07 09:52:07 -070040 }
41
42
43 // Default constructor for serialization
44 protected NetworkId() {
Jian Lib6d998e2016-02-29 11:41:18 -080045 super(-1L);
Thomas Vachuska7b438af2015-07-07 09:52:07 -070046 }
47
48 /**
49 * Creates a network id using the supplied backing id.
50 *
51 * @param id network id
52 * @return network identifier
53 */
54 public static NetworkId networkId(long id) {
55 return new NetworkId(id);
56 }
Thomas Vachuska7b438af2015-07-07 09:52:07 -070057}