Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 52f2cd1 | 2018-11-08 21:20:04 -0800 | [diff] [blame] | 2 | * Copyright 2018-present Open Networking Foundation |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -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.incubator.net.domain; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 19 | import org.onlab.util.Identifier; |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 20 | |
| 21 | import static com.google.common.base.Preconditions.checkNotNull; |
| 22 | |
| 23 | /** |
| 24 | * Intent domain identifier. |
| 25 | */ |
| 26 | @Beta |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 27 | public class IntentDomainId extends Identifier<String> { |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Creates an intent domain identifier from the specified string representation. |
| 30 | * |
| 31 | * @param value string value |
| 32 | * @return intent identifier |
| 33 | */ |
| 34 | public static IntentDomainId valueOf(String value) { |
| 35 | return new IntentDomainId(value); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Constructor for serializer. |
| 40 | */ |
| 41 | IntentDomainId() { |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 42 | super(null); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Constructs the ID corresponding to a given string value. |
| 47 | * |
| 48 | * @param value the underlying value of this ID |
| 49 | */ |
| 50 | IntentDomainId(String value) { |
Jian Li | b6d998e | 2016-02-29 11:41:18 -0800 | [diff] [blame] | 51 | super(checkNotNull(value, "Intent domain ID cannot be null.")); |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 52 | } |
| 53 | } |