Package com.example.common.command
Class CountUserCommand
java.lang.Object
com.example.common.command.BaseCommand
com.example.common.command.CountUserCommand
- All Implemented Interfaces:
Command
Class for user command COUNT_USERS
-
Field Summary
Fields inherited from class com.example.common.command.BaseCommand
chatInterface, description, messageSender, name
-
Constructor Summary
ConstructorsConstructorDescriptionCountUserCommand
(MessageSender messageSender, ChatInterface chatInterface) Constructor for the CountUserCommand. -
Method Summary
Modifier and TypeMethodDescriptionexecute
(BodyMessage bodyMessage) Executes the CountUserCommand by sending the count of users to the requesting client.Methods inherited from class com.example.common.command.BaseCommand
getDescription, getName
-
Constructor Details
-
CountUserCommand
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
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.
-