Sho SHIMIZU | f95b96e | 2016-01-25 19:35:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | */ |
| 16 | package org.onosproject.net.newresource; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | |
| 20 | /** |
| 21 | * Factory class for discrete-type resource related instances. |
| 22 | */ |
| 23 | @Beta |
| 24 | public final class DiscreteFactory { |
| 25 | private final DiscreteResourceId id; |
Sho SHIMIZU | 49fff75 | 2016-02-09 15:29:09 -0800 | [diff] [blame] | 26 | private final DiscreteResource resource; |
Sho SHIMIZU | f95b96e | 2016-01-25 19:35:15 -0800 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Create an instance with the specified resource ID. |
| 30 | * |
| 31 | * @param id resource ID that is associated with the resource related instances |
| 32 | * which will be created from this instance |
| 33 | */ |
| 34 | DiscreteFactory(DiscreteResourceId id) { |
| 35 | this.id = id; |
Sho SHIMIZU | 49fff75 | 2016-02-09 15:29:09 -0800 | [diff] [blame] | 36 | this.resource = new DiscreteResource(id); |
Sho SHIMIZU | f95b96e | 2016-01-25 19:35:15 -0800 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Returns the resource ID for discrete-type. |
| 41 | * |
| 42 | * @return discrete-type resource ID |
| 43 | */ |
| 44 | public DiscreteResourceId id() { |
| 45 | return id; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the resource for discrete-type. |
| 50 | * |
| 51 | * @return discrete-type resource |
| 52 | */ |
| 53 | public DiscreteResource resource() { |
Sho SHIMIZU | 49fff75 | 2016-02-09 15:29:09 -0800 | [diff] [blame] | 54 | return resource; |
Sho SHIMIZU | f95b96e | 2016-01-25 19:35:15 -0800 | [diff] [blame] | 55 | } |
| 56 | } |