Class AbstractIdentifiable

java.lang.Object
ubic.gemma.model.common.AbstractIdentifiable
All Implemented Interfaces:
Identifiable
Direct Known Subclasses:
AbstractDescribable, AlternateName, AuditEvent, AuditEventType, AuditTrail, BibRefAnnotation, BioAssayDimension, BioSequence2GeneProduct, Chromosome, ChromosomeLocation, CurationDetails, DatabaseEntry, DataVector, Eigenvalue, Eigenvector, FactorValue, Geeq, Gene2GOAssociation, GeneAlias, GeneDifferentialExpressionMetaAnalysisResult, GeneSetMember, GroupAuthority, HitListSize, MeanVarianceRelation, Measurement, Multifunctionality, ProbeLoading, PvalueDistribution, SampleCoexpressionMatrix, SequenceSimilaritySearchResult, SingleCellDimension, Taxon, Unit

public abstract class AbstractIdentifiable extends Object implements Identifiable
Base class for identifiable entities.

Provide basics for holding the ID and rendering the object as a string and forces implementation to overrride hashCode() and equals().

Author:
poirigui
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    equals(Object object)
    Important note: Two objects with the same class and non-null ID must be considered equal.
     
    abstract int
    Important note: Never use the ID in the hashCode() implementation since it can be assigned when the object is persisted.
    void
    setId(Long id)
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AbstractIdentifiable

      public AbstractIdentifiable()
  • Method Details

    • getId

      public Long getId()
      Specified by:
      getId in interface Identifiable
    • setId

      public void setId(Long id)
    • hashCode

      public abstract int hashCode()
      Important note: Never use the ID in the hashCode() implementation since it can be assigned when the object is persisted.
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(Object object)
      Important note: Two objects with the same class and non-null ID must be considered equal. If one or both IDs are nulls, the rest of the state can be used to determine equality.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object