blob: 2b5eb076b87d4522e17100e949f2a64c01349b23 [file] [log] [blame]
Jordi Ortizaa8de492016-12-01 00:21:36 +01001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Jordi Ortizaa8de492016-12-01 00:21:36 +01003 *
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 */
16package org.onosproject.net.meter;
17
18import org.onosproject.net.DeviceId;
19
20import java.util.Objects;
21
22/**
23 * A meter features key represents a meter features uniquely.
24 * Right now only deviceId is used but this class might be useful in
25 * virtualization in which a unique deviceId could have multiple features (guess).
Wailok Shumbe900bd2021-08-05 00:55:47 +080026 * @deprecated in onos-2.5 replaced by {@link MeterTableKey}
Jordi Ortizaa8de492016-12-01 00:21:36 +010027 */
Wailok Shumbe900bd2021-08-05 00:55:47 +080028@Deprecated
Jordi Ortizaa8de492016-12-01 00:21:36 +010029public final class MeterFeaturesKey {
30 private final DeviceId deviceId;
31
32 private MeterFeaturesKey(DeviceId deviceId) {
33 this.deviceId = deviceId;
34 }
35
36 public static MeterFeaturesKey key(DeviceId did) {
37 return new MeterFeaturesKey(did);
38 }
39
40 @Override
41 public boolean equals(Object obj) {
42 if (this == obj) {
43 return true;
44 }
45 if (obj == null || getClass() != obj.getClass()) {
46 return false;
47 }
48 MeterFeaturesKey mfk = (MeterFeaturesKey) obj;
49 return Objects.equals(deviceId, mfk.deviceId());
50 }
51
52 @Override
53 public int hashCode() {
54 return Objects.hashCode(deviceId);
55 }
56
57 @Override
58 public String toString() {
59 return "mfk@" + deviceId.toString();
60 }
61
62 public DeviceId deviceId() {
63 return deviceId;
64 }
65}