All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.annot8.common.implementations.references.AbstractAnnotationReference Maven / Gradle / Ivy

There is a newer version: 0.2.0
Show newest version
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */
package io.annot8.common.implementations.references;

import java.util.Objects;

import io.annot8.core.references.AnnotationReference;

/**
 * Abstract implementation of AnnotationReference, providing correct implementations of equals,
 * hashCode and toString.
 *
 * 

Two annotation references are taken to be equal if the following properties are all equal. The * actual implementation of the annotation reference is seen to be irrelevant and not checked. * *

    *
  • annotationId *
  • contentName *
*/ public abstract class AbstractAnnotationReference implements AnnotationReference { @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null) { return false; } if (!AnnotationReference.class.isAssignableFrom(other.getClass())) { return false; } AnnotationReference that = (AnnotationReference) other; return Objects.equals(getAnnotationId(), that.getAnnotationId()) && Objects.equals(getContentId(), that.getContentId()); } @Override public int hashCode() { return Objects.hash(getAnnotationId(), getContentId()); } @Override public String toString() { return this.getClass().getName() + " [annotationId=" + getAnnotationId() + ", contentId=" + getContentId() + "]"; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy