blob: 891ef41532f4c315d35530b9c2e3e4a0c2e6bbf3 [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 continuous-type resource related instances.
22 */
23@Beta
24public final class ContinuousFactory {
25 private final ContinuousResourceId id;
26
27 /**
28 * Creates an instance with the specified resource ID.
29 *
30 * @param id resource ID that is associated with the resource related instances
31 * which will be created from this instance
32 */
33 ContinuousFactory(ContinuousResourceId id) {
34 this.id = id;
35 }
36
37 /**
38 * Returns the resource ID for continuous-type.
39 *
40 * @return continuous-type resource ID
41 */
42 public ContinuousResourceId id() {
43 return id;
44 }
45
46 /**
47 * Returns the resource for continuous-type specified by the given value.
48 *
49 * @param volume volume of the returned resource
50 * @return continuous-type resource
51 */
52 public ContinuousResource resource(double volume) {
53 return new ContinuousResource(id(), volume);
54 }
55}