- Type Parameters:
E- The type of entity that is at the end of the link.
- All Known Subinterfaces:
LimsEntityLink<E>
- All Known Implementing Classes:
ActionsLink,ArrangementsLink,ArtifactGroupLink,ArtifactGroupLink,ArtifactLink,ArtifactLink,ArtifactLink,ArtifactLink,ArtifactLink,ArtifactLink,AutomaticNextStepLink,AutomationLink,ClarityFile,ContainerLink,ContainerLink,ContainerLink,ContainerTypeLink,ContainerTypeLink,ContainerTypeLink,ControlTypeLink,ControlTypeLink,ControlTypeLink,ControlTypeLink,ControlTypeLink,CreationInput,DemuxArtifact,DemuxArtifactSample,DemuxLink,DemuxSourceArtifact,EscalatedArtifact,FieldLink,FileLink,GlobalTokenLink,Input,Input,InstrumentLink,InstrumentLink,InstrumentLink,InstrumentLink,InstrumentLink,InstrumentTypeLink,InstrumentTypeProcessType,LabLink,LabLink,LimsEntityLinkBase,LimsLinkBase,Location,NextAction,NextStep,Output,OutputArrangement,OutputPlacement,ParentProcessLink,ParentProcessLink,PermissionLink,PermissionLink,Placement,PlacementsLink,PoolsLink,PoolStep,ProcessLink,ProcessTemplateLink,ProcessTypeLink,ProcessTypeLink,ProcessTypeLink,ProcessTypeLink,ProcessTypeLink,ProgramStatusLink,ProjectLink,ProjectLink,ProtocolLink,ProtocolLink,ProtocolLink,ProtocolStepLink,ReagentKitLink,ReagentKitLink,ReagentKitLink,ReagentKitLink,ReagentLotLink,ReagentLotLink,ReagentLotsLink,ReagentsLink,ReagentTypeLink,ResearcherLink,ResearcherLink,ResearcherLink,ResearcherLink,Role,RoleLink,SampleLink,SampleLink,SavedQueryLink,SharedResultFile,StageLink,StepConfiguration,StepDetailsLink,StepSetupLink,Submitter,Technician,Technician,Technician,Technician,TypeDefinition,TypeDefinition,UdfConfigLink,UdtConfigLink,UserLink,WorkflowLink,WorkflowLink,WorkflowStage
From release 2.34.2 onwards, all concrete implementations of
LimsLink should have their hashCode() and
equals() methods implemented so links pointing to the
same entity class with the same core URI (scheme, host, port and path)
are considered equal, even if the concrete classes are not the
same or the URI differs only by a query part. To this end,
the LimsLinkBase or LimsEntityLinkBase classes
provide convenience superclasses whose hashCode() and
equals() methods call the hashCode
and equals methods given on this
interface. Those classes that cannot inherit from these base
classes should themselves implement hashCode() and
equals() in the same way.
This interface also provides a toString
implementation that can give a default string representation for any link.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanTest a LimsLink against another object for equivalence.Get the class of the true, full LIMS entity this object links to.getLink()Since anything implementing this interface is already a link, this default implementation will just return itself.getUri()Get the URI of the object we are linking to.static intCalculate a hash code for the given link.static StringAn implementation oftoString()for links.
-
Method Details
-
getUri
URI getUri()Get the URI of the object we are linking to. -
getEntityClass
Get the class of the true, full LIMS entity this object links to.- Returns:
- The real object class.
-
getLink
Since anything implementing this interface is already a link, this default implementation will just return itself. -
hashCode
Calculate a hash code for the given link.The hash is made up of the hash of the entity class this link points to, and if the URI is not null the hash of its user info, scheme, host, port and path.
Where the URI has no explicit port set, we try get to get the default port for the protocol. This covers HTTP (80), HTTPS (443), SFTP (22).
- Parameters:
link- The link to calculate the hash code for. Cannot be null.- Returns:
- A hash code for the link.
- Throws:
NullPointerException- iflinkis null.- Since:
- 2.34.2
-
equals
Test a LimsLink against another object for equivalence.To be considered equal, two LimsLink objects must:
- Point to entities of the same class (
getEntityClassmust be the same). - Both links need their URIs to both be null, or both be set.
- If the URIs are set, some elements are compared to be equivalent:
- The user information (almost certainly null always with Clarity URIs).
- The scheme (protocol).
- The host.
- The port.
- The path.
Note that the query part of the URI is not compared. Thus URIs that point to the same stateful entity that request different states will be considered equivalent.
Where the URI has no explicit port set, we try get to get the default port for the protocol. This covers HTTP (80), HTTPS (443), SFTP (22).
- Parameters:
link- The left link for comparison. Cannot be null.obj- The right other object for testing. Can be null.- Returns:
- true if the link and the object it is compared to are equivalent, false if not.
- Throws:
NullPointerException- iflinkis null.- Since:
- 2.34.2
- Point to entities of the same class (
-
toString
An implementation oftoString()for links. The string form of a link is the name of the entity class and the LIMS id of the instance in the format "LimsLink<entity>[lims id]". If there is no LIMS id set, the value "unset" is given.- Parameters:
link- The link to convert to a string. Cannot be null.- Returns:
- The string form of the link.
- Throws:
NullPointerException- iflinkis null.- Since:
- 2.34.2
-