Class LimsLinkBase<E extends Locatable>

java.lang.Object
com.genologics.ri.LimsLinkBase<E>
Type Parameters:
E - The type of Locatable that is at the end of the link.
All Implemented Interfaces:
LimsLink<E>, Linkable<E>, Locatable, Serializable
Direct Known Subclasses:
ActionsLink, ArrangementsLink, ArtifactGroupLink, ArtifactGroupLink, ArtifactLink, AutomaticNextStepLink, AutomationLink, ContainerLink, ContainerTypeLink, ContainerTypeLink, ContainerTypeLink, ControlTypeLink, ControlTypeLink, ControlTypeLink, ControlTypeLink, CreationInput, DemuxArtifact, DemuxLink, DemuxSourceArtifact, EscalatedArtifact, FieldLink, FileLink, GlobalTokenLink, Input, InstrumentTypeLink, LimsEntityLinkBase, NextAction, NextStep, Output, OutputArrangement, OutputPlacement, PermissionLink, PermissionLink, PlacementsLink, PoolsLink, PoolStep, ProcessTemplateLink, ProcessTypeLink, ProcessTypeLink, ProgramStatusLink, ProtocolLink, ProtocolLink, ProtocolLink, ProtocolStepLink, ReagentKitLink, ReagentKitLink, ReagentKitLink, ReagentLotsLink, ReagentsLink, Role, RoleLink, SavedQueryLink, StageLink, StepDetailsLink, StepSetupLink, Submitter, Technician, Technician, Technician, Technician, TypeDefinition, TypeDefinition, UdfConfigLink, UdtConfigLink, UserLink, WorkflowLink, WorkflowLink, WorkflowStage

public abstract class LimsLinkBase<E extends Locatable> extends Object implements LimsLink<E>, Serializable
Helper base class for LimsLink implementations that implements hashCode() and equals(Object) to consider links that point to the same entities as equivalent. It also calls a standard implementation of toString() for links.

Properly implementing equals and hashCode for links allows them to be collected in a set for uniqueness or otherwise tested for equivalence without having to create maps of them where the id is the key and the link is the value. It is simpler to just put the links into a set, or stream with distinct().

The static implementations in LimsLink are used in all cases. Having these methods separate and static means any link class that already inherits from another class (so cannot inherit from this one) can easily use them. In these cases, their hashCode(), equals() and toString() methods can simply call the LimsLink static methods passing in this. This can also be the case where a class in annotated with the JAXB @XmlValue annotation. JAXB throws errors with those classes saying they can't inherit from base classes.

Since:
2.34.2
See Also: