Package com.tnsai.actions.model
Record Class ActionRequest
java.lang.Object
java.lang.Record
com.tnsai.actions.model.ActionRequest
- Record Components:
actionName- the name of the action to execute (must not be null or blank)parameters- the action parameters (never null, may be empty)
Typed request for action execution.
Replaces raw Map<String, Object> parameters with a compile-time
safe record. The parameters map is kept internally for now (Phase 1) —
individual parameter types will be refined in later phases.
Usage:
// Create from name and parameters
ActionRequest request = ActionRequest.of("searchWeb", Map.of(
"query", "Java frameworks",
"maxResults", 10
));
// Create without parameters
ActionRequest request = ActionRequest.of("getStatus");
// Use with Agent
ActionResponse response = agent.executeAction(request);
- Since:
- 0.3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionActionRequest(String actionName, Map<String, Object> parameters) Compact constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactionNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static ActionRequestCreates an ActionRequest with no parameters.static ActionRequestCreates an ActionRequest with the given name and parameters.Returns the value of theparametersrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ActionRequest
Compact constructor with validation.
-
-
Method Details
-
of
Creates an ActionRequest with the given name and parameters.- Parameters:
name- the action nameparams- the action parameters (null treated as empty)- Returns:
- a new ActionRequest
-
of
Creates an ActionRequest with no parameters.- Parameters:
name- the action name- Returns:
- a new ActionRequest with empty parameters
-
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). -
actionName
Returns the value of theactionNamerecord component.- Returns:
- the value of the
actionNamerecord component
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-