Jian Li
Committed by Gerrit Code Review

[ONOS-4014] Refactor *Id classes to extend from Identifier class

- Refactor most of *Id classes in onos-api package
- Refactor all of *Id classes in incubator package

Change-Id: Ief6322d3fb42c80e82f695e9d4dcee439346215b
Showing 22 changed files with 144 additions and 614 deletions
......@@ -52,5 +52,4 @@ public final class NodeId extends Identifier<String> implements Comparable<NodeI
public int compareTo(NodeId that) {
return identifier.compareTo(that.identifier);
}
}
......
......@@ -15,16 +15,14 @@
*/
package org.onosproject.cluster;
import static com.google.common.base.Preconditions.checkArgument;
import org.onlab.util.Identifier;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkArgument;
/**
* {@link Partition} identifier.
*/
public class PartitionId implements Comparable<PartitionId> {
private final int id;
public class PartitionId extends Identifier<Integer> implements Comparable<PartitionId> {
/**
* Creates a partition identifier from an integer.
......@@ -32,8 +30,8 @@ public class PartitionId implements Comparable<PartitionId> {
* @param id input integer
*/
public PartitionId(int id) {
super(id);
checkArgument(id >= 0, "partition id must be non-negative");
this.id = id;
}
/**
......@@ -51,33 +49,11 @@ public class PartitionId implements Comparable<PartitionId> {
* @return number
*/
public int asInt() {
return id;
}
@Override
public int hashCode() {
return id;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof PartitionId) {
final PartitionId other = (PartitionId) obj;
return Objects.equals(this.id, other.id);
}
return false;
}
@Override
public String toString() {
return String.valueOf(id);
return id();
}
@Override
public int compareTo(PartitionId that) {
return Integer.compare(this.id, that.id);
return Integer.compare(this.identifier, that.identifier);
}
}
\ No newline at end of file
......
......@@ -22,6 +22,7 @@ import java.util.Objects;
/**
* Default implementation of {@link GroupId}.
*/
// TODO: require refactor to extend from Identifier base class
public class DefaultGroupId implements GroupId {
private final int id;
......
......@@ -18,6 +18,7 @@ package org.onosproject.core;
/**
* Group identifier.
*/
// TODO: require refactor to extend from Identifier base class
public interface GroupId {
/**
......
......@@ -15,16 +15,12 @@
*/
package org.onosproject.net;
import java.util.Objects;
import com.google.common.base.MoreObjects;
import org.onlab.util.Identifier;
/*
* Representation of NSH Service path Identifier
*/
public final class NshServicePathId {
private final int servicePathId;
public final class NshServicePathId extends Identifier<Integer> {
/**
* Default constructor.
......@@ -32,7 +28,7 @@ public final class NshServicePathId {
* @param servicePathId nsh service path identifier
*/
private NshServicePathId(int servicePathId) {
this.servicePathId = servicePathId;
super(servicePathId);
}
/**
......@@ -45,39 +41,13 @@ public final class NshServicePathId {
return new NshServicePathId(servicePathId);
}
/**
* Returns nsh context service path identifier.
*
* @return the nsh context service path id
*/
public int servicePathId() {
return servicePathId;
}
@Override
public int hashCode() {
return Objects.hash(servicePathId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof NshServicePathId)) {
return false;
}
final NshServicePathId other = (NshServicePathId) obj;
return Objects.equals(this.servicePathId, other.servicePathId);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("servicePathId", servicePathId)
.toString();
return identifier;
}
}
......
......@@ -15,17 +15,15 @@
*/
package org.onosproject.net.flow;
import com.google.common.base.Objects;
import org.onlab.util.Identifier;
/**
* Representation of a Flow ID.
*/
public final class FlowId {
private final long flowid;
public final class FlowId extends Identifier<Long> {
private FlowId(long id) {
this.flowid = id;
super(id);
}
public static FlowId valueOf(long id) {
......@@ -33,26 +31,6 @@ public final class FlowId {
}
public long value() {
return flowid;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (obj.getClass() == this.getClass()) {
FlowId that = (FlowId) obj;
return Objects.equal(this.flowid, that.flowid);
}
return false;
}
@Override
public int hashCode() {
return Objects.hashCode(this.flowid);
return this.identifier;
}
}
......
......@@ -16,6 +16,7 @@
package org.onosproject.net.intent;
import com.google.common.annotations.Beta;
import org.onlab.util.Identifier;
import org.onosproject.net.newresource.ResourceConsumer;
/**
......@@ -23,9 +24,7 @@ import org.onosproject.net.newresource.ResourceConsumer;
* <p>This class is immutable.</p>
*/
@Beta
public final class IntentId implements ResourceConsumer {
private final long value;
public final class IntentId extends Identifier<Long> implements ResourceConsumer {
/**
* Creates an intent identifier from the specified long representation.
......@@ -41,7 +40,7 @@ public final class IntentId implements ResourceConsumer {
* Constructor for serializer.
*/
IntentId() {
this.value = 0;
super(0L);
}
/**
......@@ -50,7 +49,7 @@ public final class IntentId implements ResourceConsumer {
* @param value the underlying value of this ID
*/
IntentId(long value) {
this.value = value;
super(value);
}
/**
......@@ -59,29 +58,12 @@ public final class IntentId implements ResourceConsumer {
* @return the value
*/
public long fingerprint() {
return value;
}
@Override
public int hashCode() {
return Long.hashCode(value);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof IntentId)) {
return false;
}
IntentId that = (IntentId) obj;
return this.value == that.value;
return identifier;
}
@Override
public String toString() {
return "0x" + Long.toHexString(value);
return "0x" + Long.toHexString(identifier);
}
}
......
......@@ -15,64 +15,39 @@
*/
package org.onosproject.net.meter;
import org.onlab.util.Identifier;
import static com.google.common.base.Preconditions.checkArgument;
/**
* A representation of a meter id.
* Uniquely identifies a meter in the scope of a single device.
*/
public final class MeterId {
public final class MeterId extends Identifier<Long> {
static final long MAX = 0xFFFF0000;
private final long id;
public static final MeterId SLOWPATH = new MeterId(0xFFFFFFFD);
public static final MeterId CONTROLLER = new MeterId(0xFFFFFFFE);
public static final MeterId ALL = new MeterId(0xFFFFFFFF);
private MeterId(long id) {
super(id);
checkArgument(id >= MAX, "id cannot be larger than 0xFFFF0000");
this.id = id;
}
/**
* The integer representation of the meter id.
*
* @return a long
*/
public long id() {
return id;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MeterId meterId = (MeterId) o;
return id == meterId.id;
}
@Override
public int hashCode() {
return Long.hashCode(id);
}
@Override
public String toString() {
return Long.toHexString(this.id);
return Long.toHexString(this.identifier);
}
/**
* Creates a new meter identifier.
*
* @param id backing identifier value
* @return meter identifier
*/
public static MeterId meterId(long id) {
return new MeterId(id);
}
}
......
......@@ -15,20 +15,16 @@
*/
package org.onosproject.net.topology;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
import org.onlab.util.Identifier;
/**
* Representation of the topology cluster identity.
*/
public final class ClusterId {
private final int id;
public final class ClusterId extends Identifier<Integer> {
// Public construction is prohibit
private ClusterId(int id) {
this.id = id;
super(id);
}
/**
......@@ -48,29 +44,6 @@ public final class ClusterId {
* @return backing integer index
*/
public int index() {
return id;
return identifier;
}
@Override
public int hashCode() {
return id;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof ClusterId) {
final ClusterId other = (ClusterId) obj;
return Objects.equals(this.id, other.id);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("id", id).toString();
}
}
......
......@@ -15,42 +15,24 @@
*/
package org.onosproject.store.primitives;
import com.google.common.base.Objects;
import org.onlab.util.Identifier;
/**
* Transaction identifier.
*/
public final class TransactionId {
public final class TransactionId extends Identifier<String> {
/**
* Creates a new transaction identifier.
*
* @param id backing identifier value
* @return transaction identifier
*/
public static TransactionId from(String id) {
return new TransactionId(id);
}
private final String id;
private TransactionId(String id) {
this.id = id;
}
@Override
public String toString() {
return id;
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other instanceof TransactionId) {
TransactionId that = (TransactionId) other;
return Objects.equal(this.id, that.id);
}
return false;
super(id);
}
}
......
......@@ -16,14 +16,12 @@
package org.onosproject.ui.topo;
import com.google.common.base.MoreObjects;
import org.onlab.util.Identifier;
/**
* Designates the identity of a button on the topology view panels.
*/
public class ButtonId {
private final String id;
public class ButtonId extends Identifier<String> {
/**
* Creates a button ID with the given identifier.
......@@ -31,39 +29,6 @@ public class ButtonId {
* @param id identifier for the button
*/
public ButtonId(String id) {
this.id = id;
}
/**
* Returns the identifier for this button.
*
* @return identifier
*/
public String id() {
return id;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("id", id()).toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ButtonId that = (ButtonId) o;
return id.equals(that.id);
}
@Override
public int hashCode() {
return id.hashCode();
super(id);
}
}
......
......@@ -15,24 +15,20 @@
*/
package org.onosproject.store.intent.impl;
import com.google.common.base.MoreObjects;
import java.util.Objects;
import org.onlab.util.Identifier;
/**
* Identifies a partition of the intent keyspace which will be assigned to and
* processed by a single ONOS instance at a time.
*/
final class PartitionId {
private final int id;
final class PartitionId extends Identifier<Integer> {
/**
* Creates a new partition ID.
*
* @param id the partition ID
*/
PartitionId(int id) {
this.id = id;
super(id);
}
/**
......@@ -41,28 +37,6 @@ final class PartitionId {
* @return ID value
*/
int value() {
return id;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof PartitionId)) {
return false;
}
PartitionId that = (PartitionId) o;
return Objects.equals(this.id, that.id);
}
@Override
public int hashCode() {
return id;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("partition ID", id)
.toString();
return identifier;
}
}
......
......@@ -16,8 +16,7 @@
package org.onosproject.incubator.net.domain;
import com.google.common.annotations.Beta;
import java.util.Objects;
import org.onlab.util.Identifier;
import static com.google.common.base.Preconditions.checkNotNull;
......@@ -25,10 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* Intent domain identifier.
*/
@Beta
public class IntentDomainId {
private final String id;
public class IntentDomainId extends Identifier<String> {
/**
* Creates an intent domain identifier from the specified string representation.
*
......@@ -43,7 +39,7 @@ public class IntentDomainId {
* Constructor for serializer.
*/
IntentDomainId() {
this.id = null;
super(null);
}
/**
......@@ -52,28 +48,6 @@ public class IntentDomainId {
* @param value the underlying value of this ID
*/
IntentDomainId(String value) {
this.id = checkNotNull(value, "Intent domain ID cannot be null.");
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof IntentDomainId)) {
return false;
}
IntentDomainId that = (IntentDomainId) obj;
return Objects.equals(this.id, that.id);
}
@Override
public String toString() {
return id;
super(checkNotNull(value, "Intent domain ID cannot be null."));
}
}
......
......@@ -15,29 +15,29 @@
*/
package org.onosproject.incubator.net.faultmanagement.alarm;
import static com.google.common.base.Preconditions.checkArgument;
import com.google.common.collect.ImmutableSet;
import org.onlab.util.Identifier;
import java.net.URI;
import java.util.Objects;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
/**
* Immutable representation of a alarm source. It is meaningful within the
* context of a device.
*/
public final class AlarmEntityId {
public final class AlarmEntityId extends Identifier<URI> {
public static final AlarmEntityId NONE = new AlarmEntityId(URI.create("none:none"));
public static final Set<String> SCHEMES = ImmutableSet.of("none", "port", "och", "other");
private final URI uri;
private AlarmEntityId(final URI uri) {
this.uri = uri;
super(uri);
}
protected AlarmEntityId() {
uri = NONE.uri;
super(NONE.identifier);
}
public static AlarmEntityId alarmEntityId(final String string) {
......@@ -48,28 +48,4 @@ public final class AlarmEntityId {
checkArgument(SCHEMES.contains(uri.getScheme()), "Unexpected scheme");
return new AlarmEntityId(uri);
}
@Override
public String toString() {
return uri.toString();
}
@Override
public int hashCode() {
return Objects.hash(uri);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AlarmEntityId) {
final AlarmEntityId other = (AlarmEntityId) obj;
return Objects.equals(this.uri, other.uri);
}
return false;
}
}
......
......@@ -16,8 +16,8 @@
package org.onosproject.incubator.net.faultmanagement.alarm;
import com.google.common.annotations.Beta;
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
import org.onlab.util.Identifier;
import static com.google.common.base.Preconditions.checkArgument;
/**
* Alarm identifier suitable as an external key.
......@@ -25,9 +25,8 @@ import static com.google.common.base.Preconditions.checkArgument;
* This class is immutable.</p>
*/
@Beta
public final class AlarmId {
public final class AlarmId extends Identifier<Long> {
private final long id;
public static final AlarmId NONE = new AlarmId();
/**
......@@ -36,12 +35,12 @@ public final class AlarmId {
* @param id the id
*/
private AlarmId(long id) {
super(id);
checkArgument(id != 0L, "id must be non-zero");
this.id = id;
}
private AlarmId() {
this.id = 0L;
super(0L);
}
/**
......@@ -60,29 +59,6 @@ public final class AlarmId {
* @return backing integer index
*/
public long fingerprint() {
return id;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof AlarmId) {
AlarmId other = (AlarmId) obj;
return Objects.equals(this.id, other.id);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("id", id).toString();
return identifier;
}
}
......
......@@ -16,48 +16,36 @@
package org.onosproject.incubator.net.resource.label;
import com.google.common.annotations.Beta;
import org.onlab.util.Identifier;
import org.onosproject.net.resource.ResourceId;
import java.util.Objects;
/**
* Representation of a label.
*/
@Beta
public final class LabelResourceId implements ResourceId {
private long labelId;
public final class LabelResourceId extends Identifier<Long> implements ResourceId {
/**
* Creates a new label identifier.
*
* @param labelResourceId backing identifier value
* @return label identifier
*/
public static LabelResourceId labelResourceId(long labelResourceId) {
return new LabelResourceId(labelResourceId);
}
// Public construction is prohibited
private LabelResourceId(long labelId) {
this.labelId = labelId;
super(labelId);
}
/**
* Returns label identifier.
*
* @return label identifier
*/
public long labelId() {
return labelId;
}
@Override
public int hashCode() {
return Objects.hashCode(labelId);
return identifier;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof LabelResourceId) {
LabelResourceId that = (LabelResourceId) obj;
return Objects.equals(this.labelId, that.labelId);
}
return false;
}
@Override
public String toString() {
return String.valueOf(this.labelId);
}
}
......
......@@ -16,12 +16,12 @@
package org.onosproject.incubator.net.tunnel;
import org.onlab.util.Identifier;
/**
* A wrapper class for a long used to identify domain level tunnels.
*/
public final class DomainTunnelId {
private final long value;
public final class DomainTunnelId extends Identifier<Long> {
/**
* Creates a tunnel identifier from the specified tunnel.
......@@ -47,7 +47,7 @@ public final class DomainTunnelId {
* Constructor for serializer.
*/
protected DomainTunnelId() {
this.value = 0;
super(0L);
}
/**
......@@ -56,37 +56,11 @@ public final class DomainTunnelId {
* @param value the underlying value of this domain ID
*/
public DomainTunnelId(long value) {
this.value = value;
}
/**
* Returns the backing value of this domain ID.
*
* @return the long value
*/
public long id() {
return value;
}
@Override
public int hashCode() {
return Long.hashCode(value);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof DomainTunnelId)) {
return false;
}
DomainTunnelId that = (DomainTunnelId) obj;
return this.value == that.value;
super(value);
}
@Override
public String toString() {
return "0x" + Long.toHexString(value);
return "0x" + Long.toHexString(identifier);
}
}
......
......@@ -17,14 +17,13 @@
package org.onosproject.incubator.net.tunnel;
import com.google.common.annotations.Beta;
import org.onlab.util.Identifier;
/**
* Representation of a Network Tunnel Id.
*/
@Beta
public final class NetworkTunnelId {
private final long value;
public final class NetworkTunnelId extends Identifier<Long> {
/**
* Creates an tunnel identifier from the specified tunnel.
*
......@@ -43,7 +42,7 @@ public final class NetworkTunnelId {
* Constructor for serializer.
*/
NetworkTunnelId() {
this.value = 0;
super(0L);
}
/**
......@@ -52,38 +51,11 @@ public final class NetworkTunnelId {
* @param value the underlying value of this ID
*/
public NetworkTunnelId(long value) {
this.value = value;
}
/**
* Returns the backing value.
*
* @return the value
*/
public long id() {
return value;
}
@Override
public int hashCode() {
return Long.hashCode(value);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof NetworkTunnelId)) {
return false;
}
NetworkTunnelId that = (NetworkTunnelId) obj;
return this.value == that.value;
super(value);
}
@Override
public String toString() {
return "0x" + Long.toHexString(value);
return "0x" + Long.toHexString(identifier);
}
}
......
......@@ -16,66 +16,44 @@
package org.onosproject.incubator.net.tunnel;
import java.util.Objects;
import com.google.common.annotations.Beta;
import com.google.common.primitives.UnsignedLongs;
import org.onlab.util.Identifier;
/**
* Representation of a label Id, a logical port identifier.
*/
@Beta
public final class OpticalLogicId {
/**
* Represents a logical Id.
*/
private final long logicId;
/**
* Constructor, public creation is prohibited.
*/
private OpticalLogicId(long id) {
this.logicId = id;
}
/**
* Returns the LabelId representing the specified long value.
*
* @param id identifier as long value
* @return LabelId
*/
public static OpticalLogicId logicId(long id) {
return new OpticalLogicId(id);
}
public static OpticalLogicId logicId(String string) {
return new OpticalLogicId(UnsignedLongs.decode(string));
}
public long toLong() {
return logicId;
}
@Override
public String toString() {
return UnsignedLongs.toString(logicId);
}
@Override
public int hashCode() {
return Objects.hashCode(logicId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OpticalLogicId) {
final OpticalLogicId other = (OpticalLogicId) obj;
return this.logicId == other.logicId;
}
return false;
}
public final class OpticalLogicId extends Identifier<Long> {
/**
* Constructor, public creation is prohibited.
*/
private OpticalLogicId(long id) {
super(id);
}
/**
* Returns the LabelId representing the specified long value.
*
* @param id identifier as long value
* @return LabelId
*/
public static OpticalLogicId logicId(long id) {
return new OpticalLogicId(id);
}
/**
* Returns the LabelId representing the specified string value.
*
* @param string identifier as string value
* @return LabelId
*/
public static OpticalLogicId logicId(String string) {
return new OpticalLogicId(UnsignedLongs.decode(string));
}
public long toLong() {
return identifier;
}
}
......
......@@ -17,14 +17,13 @@
package org.onosproject.incubator.net.tunnel;
import com.google.common.annotations.Beta;
import org.onlab.util.Identifier;
/**
* Representation of a Tunnel Id.
*/
@Beta
public final class TunnelId {
private final long value;
public final class TunnelId extends Identifier<Long> {
/**
* Creates an tunnel identifier from the specified tunnel.
*
......@@ -43,7 +42,7 @@ public final class TunnelId {
* Constructor for serializer.
*/
TunnelId() {
this.value = 0;
super(0L);
}
/**
......@@ -52,38 +51,11 @@ public final class TunnelId {
* @param value the underlying value of this ID
*/
TunnelId(long value) {
this.value = value;
}
/**
* Returns the backing value.
*
* @return the value
*/
public long id() {
return value;
}
@Override
public int hashCode() {
return Long.hashCode(value);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof TunnelId)) {
return false;
}
TunnelId that = (TunnelId) obj;
return this.value == that.value;
super(value);
}
@Override
public String toString() {
return "0x" + Long.toHexString(value);
return "0x" + Long.toHexString(identifier);
}
}
......
......@@ -16,14 +16,13 @@
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import java.util.Objects;
import org.onlab.util.Identifier;
/**
* Representation of network identity.
*/
@Beta
public final class NetworkId {
public final class NetworkId extends Identifier<Long> {
/**
* Represents no network, or an unspecified network.
......@@ -35,18 +34,15 @@ public final class NetworkId {
*/
public static final NetworkId PHYSICAL = networkId(0L);
private final long id;
// Public construction is prohibited
private NetworkId(long id) {
this.id = id;
super(id);
}
// Default constructor for serialization
protected NetworkId() {
this.id = -1;
super(-1L);
}
/**
......@@ -58,27 +54,4 @@ public final class NetworkId {
public static NetworkId networkId(long id) {
return new NetworkId(id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof NetworkId) {
final NetworkId that = (NetworkId) obj;
return this.getClass() == that.getClass() && this.id == that.id;
}
return false;
}
@Override
public String toString() {
return Long.toString(id);
}
}
......
......@@ -16,8 +16,7 @@
package org.onosproject.incubator.net.virtual;
import com.google.common.annotations.Beta;
import java.util.Objects;
import org.onlab.util.Identifier;
import static com.google.common.base.Preconditions.checkArgument;
......@@ -25,26 +24,22 @@ import static com.google.common.base.Preconditions.checkArgument;
* Representation of network tenant.
*/
@Beta
public final class TenantId {
public final class TenantId extends Identifier<String> {
/**
* Represents no tenant, or an unspecified tenant.
*/
public static final TenantId NONE = new TenantId();
private final String id;
// Public construction is prohibited
private TenantId(String id) {
super(id);
checkArgument(id != null && id.length() > 0, "Tenant ID cannot be null or empty");
this.id = id;
}
// Default constructor for serialization
protected TenantId() {
this.id = "";
super("");
}
/**
......@@ -56,28 +51,4 @@ public final class TenantId {
public static TenantId tenantId(String id) {
return new TenantId(id);
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof TenantId) {
final TenantId that = (TenantId) obj;
return this.getClass() == that.getClass() &&
Objects.equals(this.id, that.id);
}
return false;
}
@Override
public String toString() {
return id;
}
}
......