Record Class Request<P,I>

java.lang.Object
java.lang.Record
io.micronaut.mcp.jsonrpc.Request<P,I>
Type Parameters:
P - The type of the params field.
I - The type of the id field (String, Number, or null).
Record Components:
jsonrpc - Version of the JSON-RPC protocol.
method - A String containing the name of the method to be invoked.
params - A Structured value that holds the parameter values to be used during the invocation of the method.
id - An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification. The value SHOULD normally not be Null and Numbers SHOULD NOT contain fractional parts.

public record Request<P,I>(@Pattern(regexp="2\\.0") @NotBlank @NonNull String jsonrpc, @NotBlank @NonNull String method, P params, I id) extends Record
JSON-RPC Request.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Request(@Pattern(regexp="2\\.0") @NotBlank @NonNull String jsonrpc, @NotBlank @NonNull String method, P params, I id)
    Creates an instance of a Request record class.
    Request(String method, I id)
     
    Request(String method, P params, I id)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    id()
    Returns the value of the id record component.
    @Pattern(regexp="2\\.0") @NotBlank @NonNull String
    Returns the value of the jsonrpc record component.
    @NotBlank @NonNull String
    Returns the value of the method record component.
    Returns the value of the params record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Request

      public Request(String method, I id)
    • Request

      public Request(String method, P params, I id)
    • Request

      public Request(@Pattern(regexp="2\\.0") @NotBlank @NonNull @Pattern(regexp="2\\.0") @NotBlank @NonNull String jsonrpc, @NotBlank @NonNull @NotBlank @NonNull String method, @Nullable P params, @Nullable I id)
      Creates an instance of a Request record class.
      Parameters:
      jsonrpc - the value for the jsonrpc record component
      method - the value for the method record component
      params - the value for the params 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

      @Pattern(regexp="2\\.0") @NotBlank @NonNull public @Pattern(regexp="2\\.0") @NotBlank @NonNull String jsonrpc()
      Returns the value of the jsonrpc record component.
      Returns:
      the value of the jsonrpc record component
    • method

      @NotBlank @NonNull public @NotBlank @NonNull String method()
      Returns the value of the method record component.
      Returns:
      the value of the method record component
    • params

      @Nullable public P params()
      Returns the value of the params record component.
      Returns:
      the value of the params record component
    • id

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