Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 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 | */ |
| 16 | package org.onosproject.vtnrsc; |
| 17 | |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 18 | import org.onlab.util.Identifier; |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 19 | |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 20 | import static com.google.common.base.Preconditions.checkNotNull; |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Immutable representation of a virtual port identifier. |
| 24 | */ |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 25 | public final class VirtualPortId extends Identifier<String> { |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 26 | // Public construction is prohibited |
| 27 | private VirtualPortId(String virtualPortId) { |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 28 | super(checkNotNull(virtualPortId, "VirtualPortId cannot be null")); |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | public String portId() { |
Jian Li | d79fb94 | 2016-02-29 13:42:23 -0800 | [diff] [blame] | 32 | return identifier; |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Creates a virtualPort id using the supplied portId. |
| 37 | * |
| 38 | * @param portId virtualport identifier |
| 39 | * @return VirtualPortId |
| 40 | */ |
| 41 | public static VirtualPortId portId(String portId) { |
| 42 | return new VirtualPortId(portId); |
| 43 | } |
Sho SHIMIZU | b2b2d98 | 2015-09-11 15:35:06 -0700 | [diff] [blame] | 44 | } |