Record Class AgentQuery

java.lang.Object
java.lang.Record
dev.agenor.core.AgentQuery
Record Components:
agentType - optional agent type filter
requiredCapabilities - optional set of capabilities agents must have (ALL required)
status - optional status filter

public record AgentQuery(String agentType, Set<String> requiredCapabilities, AgentStatus status) extends Record
Query object for searching agents in the AgentDirectory.

Combines multiple criteria (AND logic). A null value for any criterion means "don't filter by this criterion".

Since:
0.1.0
  • Constructor Details

    • AgentQuery

      public AgentQuery(String agentType, Set<String> requiredCapabilities, AgentStatus status)
      Creates an instance of a AgentQuery record class.
      Parameters:
      agentType - the value for the agentType record component
      requiredCapabilities - the value for the requiredCapabilities record component
      status - the value for the status record component
  • Method Details

    • all

      public static AgentQuery all()
      Creates a query that matches every agent (no filters applied).

      Use with AgentDiscovery.findAgents(dev.agenor.core.AgentQuery, dev.agenor.core.PageRequest) and pagination.

      Returns:
      an unconstrained query
      Since:
      0.20.0
    • builder

      public static AgentQuery.AgentQueryBuilder builder()
      Creates a new query builder.
      Returns:
      a new AgentQuery.AgentQueryBuilder instance
    • byType

      public static AgentQuery byType(String agentType)
      Creates a query that filters by agent type only.
      Parameters:
      agentType - the agent type to search for, must not be null
      Returns:
      a new query matching only the specified agent type
    • byStatus

      public static AgentQuery byStatus(AgentStatus status)
      Creates a query that filters by agent status only.
      Parameters:
      status - the agent status to search for, must not be null
      Returns:
      a new query matching only the specified status
    • withCapabilities

      public static AgentQuery withCapabilities(Set<String> capabilities)
      Creates a query that filters by required capabilities.

      An agent matches only if it has ALL of the specified capabilities.

      Parameters:
      capabilities - the set of required capabilities, must not be null or empty
      Returns:
      a new query matching agents with all specified capabilities
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • agentType

      public String agentType()
      Returns the value of the agentType record component.
      Returns:
      the value of the agentType record component
    • requiredCapabilities

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

      public AgentStatus status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component