Package com.tnsai.context.entity
Record Class EntityResolutionResult
java.lang.Object
java.lang.Record
com.tnsai.context.entity.EntityResolutionResult
public record EntityResolutionResult(Entity resolvedEntity, double confidence, List<Entity> alternatives, List<String> usedSources, EntityResolutionResult.ResolutionStatus status, String message)
extends Record
Result of entity resolution, including confidence and alternatives.
When resolving an entity from multiple sources, the result includes the resolved entity, a confidence score indicating how certain we are about the resolution, and any alternative entities that were considered.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumResolution status enumeration. -
Constructor Summary
ConstructorsConstructorDescriptionEntityResolutionResult(Entity resolvedEntity, double confidence, List<Entity> alternatives, List<String> usedSources, EntityResolutionResult.ResolutionStatus status, String message) Compact constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealternativesrecord component.static EntityResolutionResultCreates a result where resolution was ambiguous.doubleReturns the value of theconfidencerecord component.final booleanIndicates whether some other object is "equal to" this one.static EntityResolutionResultCreates a result where resolution failed due to an error.booleanReturns true if there are alternatives to consider.final inthashCode()Returns a hash code value for this object.booleanReturns true if this is a high confidence resolution (>= 0.9).booleanReturns true if the resolution was successful.message()Returns the value of themessagerecord component.static EntityResolutionResultCreates a result where entity was not found.Returns the value of theresolvedEntityrecord component.status()Returns the value of thestatusrecord component.static EntityResolutionResultCreates a successful resolution result.static EntityResolutionResultsuccessWithAlternatives(Entity entity, double confidence, List<Entity> alternatives, List<String> sources) Creates a successful resolution with alternatives.final StringtoString()Returns a string representation of this record class.Returns the value of theusedSourcesrecord component.
-
Constructor Details
-
Method Details
-
success
public static EntityResolutionResult success(Entity entity, double confidence, List<String> sources) Creates a successful resolution result. -
successWithAlternatives
public static EntityResolutionResult successWithAlternatives(Entity entity, double confidence, List<Entity> alternatives, List<String> sources) Creates a successful resolution with alternatives. -
notFound
Creates a result where entity was not found. -
ambiguous
Creates a result where resolution was ambiguous. -
error
Creates a result where resolution failed due to an error. -
isHighConfidence
public boolean isHighConfidence()Returns true if this is a high confidence resolution (>= 0.9). -
isSuccess
public boolean isSuccess()Returns true if the resolution was successful. -
hasAlternatives
public boolean hasAlternatives()Returns true if there are alternatives to consider. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
resolvedEntity
Returns the value of theresolvedEntityrecord component.- Returns:
- the value of the
resolvedEntityrecord component
-
confidence
public double confidence()Returns the value of theconfidencerecord component.- Returns:
- the value of the
confidencerecord component
-
alternatives
Returns the value of thealternativesrecord component.- Returns:
- the value of the
alternativesrecord component
-
usedSources
Returns the value of theusedSourcesrecord component.- Returns:
- the value of the
usedSourcesrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-