Interface Response

All Superinterfaces:
CommonResponse, FutureMessage, RemoteMessage, UserIdentity
All Known Implementing Classes:
ResponseMessage, UserResponseMessage

public interface Response extends RemoteMessage, CommonResponse, UserIdentity
Represent an outbound response message with typed data extraction capabilities.

Extends RemoteMessage for inter-server fields, CommonResponse for error information, and UserIdentity for user binding. Provides convenience methods to decode the raw response payload into single values or lists of common types (String, int, long, boolean) as well as arbitrary protobuf-compatible types.

Since:
25.1
Author:
渔民小镇
date:
2025-09-07
  • Method Details

    • getData

      default <T> T getData(Class<T> clazz)
      Decode the response payload into the specified type.

      Alias for getValue(Class).

      Type Parameters:
      T - the target type
      Parameters:
      clazz - the class to decode into
      Returns:
      the decoded object
    • getValue

      <T> T getValue(Class<T> clazz)
      Decode the response payload into the specified type.
      Type Parameters:
      T - the target type
      Parameters:
      clazz - the class to decode into
      Returns:
      the decoded object
    • listValue

      <T> List<T> listValue(Class<? extends T> clazz)
      Decode the response payload into a list of the specified element type.
      Type Parameters:
      T - the element type
      Parameters:
      clazz - the element class to decode into
      Returns:
      a list of decoded objects
    • getString

      default String getString()
      Get the response payload as a single String value.
      Returns:
      the decoded string
    • listString

      default List<String> listString()
      Get the response payload as a list of String values.
      Returns:
      the decoded string list
    • getInt

      default int getInt()
      Get the response payload as a single int value.
      Returns:
      the decoded int
    • listInt

      default List<Integer> listInt()
      Get the response payload as a list of Integer values.
      Returns:
      the decoded integer list
    • getLong

      default long getLong()
      Get the response payload as a single long value.
      Returns:
      the decoded long
    • listLong

      default List<Long> listLong()
      Get the response payload as a list of Long values.
      Returns:
      the decoded long list
    • getBoolean

      default boolean getBoolean()
      Get the response payload as a single boolean value.
      Returns:
      the decoded boolean
    • listBoolean

      default List<Boolean> listBoolean()
      Get the response payload as a list of Boolean values.
      Returns:
      the decoded boolean list