blob: d96ed74aceed2266c1906ed21302af4cf36f34b8 [file] [log] [blame]
Aihua Guo1ce2dd12016-08-12 23:37:44 -04001/*
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 */
16package org.onosproject.tetopology.management.api;
17
18import com.google.common.base.MoreObjects;
19import com.google.common.base.Objects;
20
21/**
22 * TE Topology identifiers.
23 */
24public class TeTopologyId {
25 private final long providerId;
26 private final long clientId;
27 private final String topologyId;
28
29 /**
30 * Creates an instance of TE topology identifier.
31 *
32 * @param providerId value of provider identifier
33 * @param clientId value of client identifier
34 * @param topologyId value of topology identifier
35 */
36 public TeTopologyId(long providerId, long clientId, String topologyId) {
37 this.providerId = providerId;
38 this.clientId = clientId;
39 this.topologyId = topologyId;
40 }
41
42 /**
43 * Returns the provider identifier.
44 *
45 * @return provider identifier
46 */
47 public long providerId() {
48 return providerId;
49 }
50
51 /**
52 * Returns the client identifier.
53 *
54 * @return client identifier
55 */
56 public long clientId() {
57 return clientId;
58 }
59
60 /**
61 * Returns the topology identifier.
62 *
63 * @return topology identifier
64 */
65 public String topologyId() {
66 return topologyId;
67 }
68
69 @Override
70 public int hashCode() {
71 return Objects.hashCode(providerId, clientId, topologyId);
72 }
73
74 @Override
75 public boolean equals(Object object) {
76 if (this == object) {
77 return true;
78 }
79 if (object instanceof TeTopologyId) {
80 TeTopologyId that = (TeTopologyId) object;
81 return Objects.equal(this.providerId, that.providerId) &&
82 Objects.equal(this.clientId, that.clientId) &&
83 Objects.equal(this.topologyId, that.topologyId);
84 }
85 return false;
86 }
87
88 @Override
89 public String toString() {
90 return MoreObjects.toStringHelper(this)
91 .add("providerId", providerId)
92 .add("clientId", clientId)
93 .add("topologyId", topologyId)
94 .toString();
95 }
96}