Class MessageCommand

java.lang.Object
com.example.common.command.BaseCommand
com.example.common.command.MessageCommand
All Implemented Interfaces:
Command

public class MessageCommand extends BaseCommand
The MessageCommand class represents a command that handles user messages in the chat application.
  • Constructor Details

  • Method Details

    • execute

      public Status execute(BodyMessage bodyMessage) throws IOException
      Executes the MessageCommand by processing the body message received from a user. If the message corresponds to a command, it executes the command; otherwise, it sends the message to the chat.
      Parameters:
      bodyMessage - The BodyMessage containing the user's message details.
      Returns:
      The execution status of the command (SUCCESS or ERROR).
      Throws:
      IOException - if an I/O error occurs during message sending.