Class CommandFactory

java.lang.Object
com.example.common.command.CommandFactory

public class CommandFactory extends Object
The CommandFactory class provides static methods for creating different types of commands.
  • Constructor Details

    • CommandFactory

      public CommandFactory()
  • Method Details

    • getCountUserCommand

      public static Command getCountUserCommand(MessageSender messageSender, ChatInterface chatInterface)
      Creates and returns a CountUserCommand object.
      Parameters:
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface managing clients in the chat.
      Returns:
      A CountUserCommand object.
    • getExitCommand

      public static Command getExitCommand(MessageSender messageSender, ChatInterface chatInterface)
      Creates and returns an ExitCommand object.
      Parameters:
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface managing clients in the chat.
      Returns:
      An ExitCommand object.
    • getHelpCommand

      public static Command getHelpCommand(CommandsInterface commandsInterface, MessageSender messageSender, ChatInterface chatInterface)
      Creates and returns a HelpCommand object.
      Parameters:
      commandsInterface - The CommandsInterface for managing commands.
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface managing clients in the chat.
      Returns:
      A HelpCommand object.
    • getLoginCommand

      public static Command getLoginCommand(MessageSender messageSender, ChatInterface chatInterface)
      Creates and returns a LoginCommand object.
      Parameters:
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface managing clients in the chat.
      Returns:
      A LoginCommand object.
    • getMessageCommand

      public static Command getMessageCommand(MessageSender messageSender, ChatInterface chatInterface, CommandsInterface commandsInterface)
      Creates and returns a MessageCommand object.
      Parameters:
      messageSender - The MessageSender object for sending messages.
      chatInterface - The ChatInterface managing clients in the chat.
      commandsInterface - The CommandsInterface for managing commands.
      Returns:
      A MessageCommand object.
    • getCommandsCollection

      public static CommandsInterface getCommandsCollection()
      Returns a new instance of CommandsCollection.
      Returns:
      A CommandsCollection object.