Record Class SuccessfulResponse<R,I>

java.lang.Object
java.lang.Record
io.micronaut.mcp.jsonrpc.SuccessfulResponse<R,I>
Type Parameters:
R - The type of the result field.
I - The type of the id field (String, Number, or null).
Record Components:
jsonrpc - Version of the JSON-RPC protocol.
result - The value is determined by the method invoked on the Server.
id - This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object, it MUST be Null.

public record SuccessfulResponse<R,I>(@NonNull String jsonrpc, R result, I id) extends Record
JSON-RPC Successful Response.
See Also:
  • Constructor Details

    • SuccessfulResponse

      public SuccessfulResponse(R result, I id)
    • SuccessfulResponse

      public SuccessfulResponse(@NonNull @NonNull String jsonrpc, @NonNull R result, @Nullable I id)
      Creates an instance of a SuccessfulResponse record class.
      Parameters:
      jsonrpc - the value for the jsonrpc record component
      result - the value for the result record component
      id - the value for the id record component
  • Method Details

    • 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.
    • jsonrpc

      @NonNull public @NonNull String jsonrpc()
      Returns the value of the jsonrpc record component.
      Returns:
      the value of the jsonrpc record component
    • result

      @NonNull public R result()
      Returns the value of the result record component.
      Returns:
      the value of the result record component
    • id

      @Nullable public I id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component