Class CountUserCommand

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

public class CountUserCommand extends BaseCommand
Class for user command COUNT_USERS
  • Constructor Details

    • CountUserCommand

      public CountUserCommand(MessageSender messageSender, ChatInterface chatInterface)
      Constructor for the CountUserCommand.
      Parameters:
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface containing information about clients in the chat.
  • Method Details

    • execute

      public Status execute(BodyMessage bodyMessage) throws IOException
      Executes the CountUserCommand by sending the count of users to the requesting client.
      Parameters:
      bodyMessage - The BodyMessage received with the command request.
      Returns:
      The execution status of the command (SUCCESS or ERROR).
      Throws:
      IOException - if an I/O error occurs during message sending.