Class A2AResponse<T>
java.lang.Object
org.a2aproject.sdk.jsonrpc.common.wrappers.A2AResponse<T>
- Type Parameters:
T- the type of the result value returned in successful responses
- All Implemented Interfaces:
A2AMessage
- Direct Known Subclasses:
A2AErrorResponse,CancelTaskResponse,CreateTaskPushNotificationConfigResponse,DeleteTaskPushNotificationConfigResponse,GetExtendedAgentCardResponse,GetTaskPushNotificationConfigResponse,GetTaskResponse,ListTaskPushNotificationConfigsResponse,ListTasksResponse,SendMessageResponse,SendStreamingMessageResponse
public abstract sealed class A2AResponse<T>
extends Object
implements A2AMessage
permits CancelTaskResponse, DeleteTaskPushNotificationConfigResponse, GetExtendedAgentCardResponse, GetTaskPushNotificationConfigResponse, GetTaskResponse, A2AErrorResponse, ListTaskPushNotificationConfigsResponse, ListTasksResponse, SendMessageResponse, SendStreamingMessageResponse, CreateTaskPushNotificationConfigResponse
Represents a JSONRPC response.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected A2AErrorThe error object if the invocation failed.protected ObjectThe request identifier this response corresponds to.protected StringThe JSON-RPC protocol version.protected TThe result of the method invocation.Fields inherited from interface org.a2aproject.sdk.jsonrpc.common.wrappers.A2AMessage
JSONRPC_VERSION -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for deserialization.Constructs a JSON-RPC response. -
Method Summary
-
Field Details
-
jsonrpc
The JSON-RPC protocol version. -
id
The request identifier this response corresponds to. -
result
The result of the method invocation. -
error
The error object if the invocation failed.
-
-
Constructor Details
-
A2AResponse
public A2AResponse()Default constructor for deserialization. -
A2AResponse
Constructs a JSON-RPC response.- Parameters:
jsonrpc- the JSON-RPC versionid- the request IDresult- the result valueerror- the error if anyresultType- the result type class
-
-
Method Details
-
getJsonrpc
Description copied from interface:A2AMessageGets the JSON-RPC version for this message.According to the JSON-RPC 2.0 specification, this must be exactly "2.0".
- Specified by:
getJsonrpcin interfaceA2AMessage- Returns:
- the JSON-RPC version string, always "2.0"
-
getId
Description copied from interface:A2AMessageGets the request/response correlation identifier.The ID is used to match responses with their corresponding requests. It may be a String, Integer, or null for notification-style requests that do not expect a response.
- Specified by:
getIdin interfaceA2AMessage- Returns:
- the correlation ID, or null for notifications
-
getResult
Gets the result value.- Returns:
- the result
-
getError
Gets the error object.- Returns:
- the error if any
-