Naoki Shiota | 5a05606 | 2016-05-05 18:43:59 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame^] | 2 | * Copyright 2016-present Open Networking Foundation |
Naoki Shiota | 5a05606 | 2016-05-05 18:43:59 -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.newoptical.api; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | import com.google.common.base.MoreObjects; |
| 20 | import org.onlab.util.Identifier; |
Naoki Shiota | cb744db | 2016-05-13 19:32:35 -0700 | [diff] [blame] | 21 | import org.onosproject.net.resource.ResourceConsumer; |
| 22 | import org.onosproject.net.resource.ResourceConsumerId; |
Naoki Shiota | 5a05606 | 2016-05-05 18:43:59 -0700 | [diff] [blame] | 23 | |
| 24 | // TODO: After ResourceManager is made to accept app-defined ResourceConsumer, |
| 25 | // this class should be implemented as ResourceConsumer. |
| 26 | /** |
| 27 | * ID for optical connectivity. |
| 28 | */ |
| 29 | @Beta |
Naoki Shiota | cb744db | 2016-05-13 19:32:35 -0700 | [diff] [blame] | 30 | public final class OpticalConnectivityId extends Identifier<Long> implements ResourceConsumer { |
Naoki Shiota | 5a05606 | 2016-05-05 18:43:59 -0700 | [diff] [blame] | 31 | |
| 32 | public static OpticalConnectivityId of(long value) { |
| 33 | return new OpticalConnectivityId(value); |
| 34 | } |
| 35 | |
| 36 | OpticalConnectivityId(long value) { |
| 37 | super(value); |
| 38 | } |
| 39 | |
| 40 | @Override |
Naoki Shiota | cb744db | 2016-05-13 19:32:35 -0700 | [diff] [blame] | 41 | public ResourceConsumerId consumerId() { |
| 42 | return ResourceConsumerId.of(this); |
| 43 | } |
| 44 | |
| 45 | @Override |
Naoki Shiota | 5a05606 | 2016-05-05 18:43:59 -0700 | [diff] [blame] | 46 | public String toString() { |
| 47 | return MoreObjects.toStringHelper(this) |
| 48 | .add("value", id()) |
| 49 | .toString(); |
| 50 | } |
| 51 | } |