Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present 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 | */ |
Hyunsun Moon | fd5a24e | 2016-10-19 19:15:48 -0700 | [diff] [blame] | 16 | package org.opencord.cordvtn.api.net; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 17 | |
Hyunsun Moon | 4a94c2e | 2016-10-21 17:37:05 -0700 | [diff] [blame] | 18 | import com.google.common.base.Strings; |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 19 | import org.onlab.util.Identifier; |
| 20 | |
Hyunsun Moon | 4a94c2e | 2016-10-21 17:37:05 -0700 | [diff] [blame] | 21 | import static com.google.common.base.Preconditions.checkArgument; |
| 22 | |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Representation of the network identifier. |
| 25 | */ |
| 26 | public final class NetworkId extends Identifier<String> { |
| 27 | |
| 28 | /** |
| 29 | * Default constructor. |
| 30 | * |
| 31 | * @param id string network identifier |
| 32 | */ |
| 33 | private NetworkId(String id) { |
| 34 | super(id); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Returns the network identifier with the supplied value. |
| 39 | * |
| 40 | * @param id string network identifier |
| 41 | * @return network identifier |
| 42 | */ |
| 43 | public static NetworkId of(String id) { |
Hyunsun Moon | 4a94c2e | 2016-10-21 17:37:05 -0700 | [diff] [blame] | 44 | checkArgument(!Strings.isNullOrEmpty(id)); |
Hyunsun Moon | 395542a | 2016-09-01 13:53:08 -0700 | [diff] [blame] | 45 | return new NetworkId(id); |
| 46 | } |
| 47 | } |