Package dev.agenor.core
Record Class AgentQuery
java.lang.Object
java.lang.Record
dev.agenor.core.AgentQuery
- Record Components:
agentType- optional agent type filterrequiredCapabilities- 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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFluent builder for constructingAgentQueryinstances. -
Constructor Summary
ConstructorsConstructorDescriptionAgentQuery(String agentType, Set<String> requiredCapabilities, AgentStatus status) Creates an instance of aAgentQueryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theagentTyperecord component.static AgentQueryall()Creates a query that matches every agent (no filters applied).static AgentQuery.AgentQueryBuilderbuilder()Creates a new query builder.static AgentQuerybyStatus(AgentStatus status) Creates a query that filters by agent status only.static AgentQueryCreates a query that filters by agent type only.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of therequiredCapabilitiesrecord component.status()Returns the value of thestatusrecord component.final StringtoString()Returns a string representation of this record class.static AgentQuerywithCapabilities(Set<String> capabilities) Creates a query that filters by required capabilities.
-
Constructor Details
-
AgentQuery
Creates an instance of aAgentQueryrecord class.- Parameters:
agentType- the value for theagentTyperecord componentrequiredCapabilities- the value for therequiredCapabilitiesrecord componentstatus- the value for thestatusrecord component
-
-
Method Details
-
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
Creates a new query builder.- Returns:
- a new
AgentQuery.AgentQueryBuilderinstance
-
byType
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
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
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
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. All components in this record class are compared withObjects::equals(Object,Object). -
agentType
Returns the value of theagentTyperecord component.- Returns:
- the value of the
agentTyperecord component
-
requiredCapabilities
Returns the value of therequiredCapabilitiesrecord component.- Returns:
- the value of the
requiredCapabilitiesrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-