blob: 05d3f06a8cb37c62619aef1a3a2c99b86b953ce3 [file] [log] [blame]
Sho SHIMIZUf95b96e2016-01-25 19:35:15 -08001/*
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 */
Sho SHIMIZUe18cb122016-02-22 21:04:56 -080016package org.onosproject.net.resource;
Sho SHIMIZUf95b96e2016-01-25 19:35:15 -080017
18import com.google.common.annotations.Beta;
19
20/**
21 * Factory class for discrete-type resource related instances.
22 */
23@Beta
24public final class DiscreteFactory {
25 private final DiscreteResourceId id;
Sho SHIMIZU49fff752016-02-09 15:29:09 -080026 private final DiscreteResource resource;
Sho SHIMIZUf95b96e2016-01-25 19:35:15 -080027
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 SHIMIZU49fff752016-02-09 15:29:09 -080036 this.resource = new DiscreteResource(id);
Sho SHIMIZUf95b96e2016-01-25 19:35:15 -080037 }
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 SHIMIZU49fff752016-02-09 15:29:09 -080054 return resource;
Sho SHIMIZUf95b96e2016-01-25 19:35:15 -080055 }
56}