io.annot8.common.implementations.references.AbstractGroupReference Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of annot8-common-implementations Show documentation
Show all versions of annot8-common-implementations Show documentation
Common functionality used by Annot8 implementations
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */
package io.annot8.common.implementations.references;
import java.util.Objects;
import io.annot8.core.references.GroupReference;
/**
* Abstract implementation of GroupReference, providing correct implementations of equals, hashCode
* and toString.
*
* Two group references are taken to be equal if the following properties are all equal. The
* actual implementation of the group reference is seen to be irrelevant and not checked.
*
*
* - groupId
*
*/
public abstract class AbstractGroupReference implements GroupReference {
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other == null) {
return false;
}
if (!GroupReference.class.isAssignableFrom(other.getClass())) {
return false;
}
GroupReference that = (GroupReference) other;
return Objects.equals(getGroupId(), that.getGroupId());
}
@Override
public int hashCode() {
return Objects.hash(getGroupId());
}
@Override
public String toString() {
return this.getClass().getName() + " [groupId=" + getGroupId() + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy