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.

  • 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

      public static EntityResolutionResult notFound(String entityId)
      Creates a result where entity was not found.
    • ambiguous

      public static EntityResolutionResult ambiguous(List<Entity> candidates, List<String> sources)
      Creates a result where resolution was ambiguous.
    • error

      public static EntityResolutionResult error(String message)
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • resolvedEntity

      public Entity resolvedEntity()
      Returns the value of the resolvedEntity record component.
      Returns:
      the value of the resolvedEntity record component
    • confidence

      public double confidence()
      Returns the value of the confidence record component.
      Returns:
      the value of the confidence record component
    • alternatives

      public List<Entity> alternatives()
      Returns the value of the alternatives record component.
      Returns:
      the value of the alternatives record component
    • usedSources

      public List<String> usedSources()
      Returns the value of the usedSources record component.
      Returns:
      the value of the usedSources record component
    • status

      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component