blob: 1b88d003e2c85a2f4f3d02929a83800d76d18fa9 [file] [log] [blame]
Aihua Guo1ce2dd12016-08-12 23:37:44 -04001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016 Open Networking Foundation
Aihua Guo1ce2dd12016-08-12 23:37:44 -04003 *
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
Aihua Guo1ce2dd12016-08-12 23:37:44 -040018import com.google.common.base.Objects;
19
20/**
Henry Yu4b4a7eb2016-11-09 20:07:53 -050021 * TE Topology identifier in String format.
Aihua Guo1ce2dd12016-08-12 23:37:44 -040022 */
Henry Yu4b4a7eb2016-11-09 20:07:53 -050023public class TeTopologyId extends ProviderClientId {
Aihua Guo1ce2dd12016-08-12 23:37:44 -040024 private final String topologyId;
25
26 /**
27 * Creates an instance of TE topology identifier.
28 *
29 * @param providerId value of provider identifier
30 * @param clientId value of client identifier
31 * @param topologyId value of topology identifier
32 */
33 public TeTopologyId(long providerId, long clientId, String topologyId) {
Henry Yu4b4a7eb2016-11-09 20:07:53 -050034 super(providerId, clientId);
Aihua Guo1ce2dd12016-08-12 23:37:44 -040035 this.topologyId = topologyId;
36 }
37
38 /**
Aihua Guo1ce2dd12016-08-12 23:37:44 -040039 * Returns the topology identifier.
40 *
41 * @return topology identifier
42 */
43 public String topologyId() {
44 return topologyId;
45 }
46
47 @Override
48 public int hashCode() {
Henry Yu4b4a7eb2016-11-09 20:07:53 -050049 return Objects.hashCode(super.hashCode(), topologyId);
Aihua Guo1ce2dd12016-08-12 23:37:44 -040050 }
51
52 @Override
53 public boolean equals(Object object) {
54 if (this == object) {
55 return true;
56 }
57 if (object instanceof TeTopologyId) {
Henry Yu4b4a7eb2016-11-09 20:07:53 -050058 if (!super.equals(object)) {
59 return false;
60 }
Aihua Guo1ce2dd12016-08-12 23:37:44 -040061 TeTopologyId that = (TeTopologyId) object;
Henry Yu4b4a7eb2016-11-09 20:07:53 -050062 return Objects.equal(this.topologyId, that.topologyId);
Aihua Guo1ce2dd12016-08-12 23:37:44 -040063 }
64 return false;
65 }
66
67 @Override
68 public String toString() {
Henry Yu4b4a7eb2016-11-09 20:07:53 -050069 return toStringHelper()
Aihua Guo1ce2dd12016-08-12 23:37:44 -040070 .add("topologyId", topologyId)
71 .toString();
72 }
73}