Class ResponseMessage

java.lang.Object
com.iohao.net.framework.protocol.CommonMessage
com.iohao.net.framework.protocol.ResponseMessage
All Implemented Interfaces:
CommonResponse, FutureMessage, RemoteMessage, Response, UserIdentity

public final class ResponseMessage extends CommonMessage implements Response
Internal response message used for logic-to-logic server communication via Aeron.

Extends CommonMessage and implements Response to provide typed data extraction from the serialized payload. Carries user identity and error information alongside the decoded response data.

Since:
25.1
Author:
渔民小镇
date:
2025-09-03
  • Constructor Details

    • ResponseMessage

      public ResponseMessage()
  • Method Details

    • getValue

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

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

      public long getUserId()
      Description copied from interface: UserIdentity
      Get the user id.
      Specified by:
      getUserId in interface UserIdentity
      Returns:
      the user id
    • isVerifyIdentity

      public boolean isVerifyIdentity()
      Description copied from interface: UserIdentity
      Check whether the user's identity has been verified (authenticated).
      Specified by:
      isVerifyIdentity in interface UserIdentity
      Returns:
      true if the identity is verified
    • getErrorCode

      public int getErrorCode()
      Description copied from interface: CommonResponse
      Get the error code. 0 indicates success; any other value indicates an error.
      Specified by:
      getErrorCode in interface CommonResponse
      Returns:
      the error code
    • getErrorMessage

      public String getErrorMessage()
      Description copied from interface: CommonResponse
      Get the human-readable error message.
      Specified by:
      getErrorMessage in interface CommonResponse
      Returns:
      the error message, or null on success
    • setUserId

      public void setUserId(long userId)
      Description copied from interface: UserIdentity
      Set the user id.
      Specified by:
      setUserId in interface UserIdentity
      Parameters:
      userId - the user id
    • setVerifyIdentity

      public void setVerifyIdentity(boolean verifyIdentity)
      Description copied from interface: UserIdentity
      Set the identity verification flag.
      Specified by:
      setVerifyIdentity in interface UserIdentity
      Parameters:
      verifyIdentity - true if the identity is verified
    • setErrorCode

      public void setErrorCode(int errorCode)
      Description copied from interface: CommonResponse
      Set the error code. 0 indicates success; any other value indicates an error.
      Specified by:
      setErrorCode in interface CommonResponse
      Parameters:
      errorCode - the error code
    • setErrorMessage

      public void setErrorMessage(String errorMessage)
      Description copied from interface: CommonResponse
      Set the human-readable error message.
      Specified by:
      setErrorMessage in interface CommonResponse
      Parameters:
      errorMessage - the error message
    • toString

      public String toString()
      Overrides:
      toString in class CommonMessage