blob: 41dc7a20dbffd15c885b939df197cfa82be9cabf [file] [log] [blame]
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -08003 *
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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.core;
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080017
18import com.google.common.base.MoreObjects;
19
20import java.util.Objects;
21
22/**
23 * Default implementation of {@link GroupId}.
24 */
Prince Pereira3ff504c2016-08-30 14:23:43 +053025@Deprecated
26public class DefaultGroupId extends GroupId {
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080027
28 public DefaultGroupId(int id) {
Prince Pereira3ff504c2016-08-30 14:23:43 +053029 super(id);
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080030 }
31
32 // Constructor for serialization
33 private DefaultGroupId() {
Prince Pereira3ff504c2016-08-30 14:23:43 +053034 super(0);
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080035 }
36
37 @Override
38 public int hashCode() {
Prince Pereira3ff504c2016-08-30 14:23:43 +053039 return identifier;
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080040 }
41
42 @Override
43 public boolean equals(Object obj) {
44 if (this == obj) {
45 return true;
46 }
47 if (!(obj instanceof DefaultGroupId)) {
48 return false;
49 }
50 final DefaultGroupId other = (DefaultGroupId) obj;
Prince Pereira3ff504c2016-08-30 14:23:43 +053051 return Objects.equals(this.identifier, other.identifier);
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080052 }
53
54 @Override
55 public String toString() {
56 return MoreObjects.toStringHelper(this)
Prince Pereira3ff504c2016-08-30 14:23:43 +053057 .add("id", "0x" + Integer.toHexString(identifier))
Sho SHIMIZUe3cc0b92014-11-20 16:18:29 -080058 .toString();
59 }
60}