2 * Copyright 2014 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.store.device.impl;
18 import java.util.Objects;
20 import org.onosproject.net.DeviceId;
21 import org.onosproject.net.PortNumber;
22 import org.onosproject.net.provider.ProviderId;
24 import com.google.common.base.MoreObjects;
27 * Identifier for PortDescription from a Provider.
29 public final class PortFragmentId {
30 public final ProviderId providerId;
31 public final DeviceId deviceId;
32 public final PortNumber portNumber;
34 public PortFragmentId(DeviceId deviceId, ProviderId providerId,
35 PortNumber portNumber) {
36 this.providerId = providerId;
37 this.deviceId = deviceId;
38 this.portNumber = portNumber;
42 public int hashCode() {
43 return Objects.hash(providerId, deviceId, portNumber);
47 public boolean equals(Object obj) {
51 if (!(obj instanceof PortFragmentId)) {
54 PortFragmentId that = (PortFragmentId) obj;
55 return Objects.equals(this.deviceId, that.deviceId) &&
56 Objects.equals(this.portNumber, that.portNumber) &&
57 Objects.equals(this.providerId, that.providerId);
61 public String toString() {
62 return MoreObjects.toStringHelper(getClass())
63 .add("providerId", providerId)
64 .add("deviceId", deviceId)
65 .add("portNumber", portNumber)
70 @SuppressWarnings("unused")
71 private PortFragmentId() {
72 this.providerId = null;
74 this.portNumber = null;