@startuml
!include ../Style.puml

Participant ":Parser" as Parser
Participant ":XYZCommand" as XYZCommand

activate Parser
-> Parser : parseCommand(userInput : String)
Parser -> Parser : getCommandType(userInput : String)
activate Parser
Parser --> Parser : commandType
deactivate Parser
alt commandType is "xyz"
  Parser -> Parser : prepareXYZCommand()
  note right
      XYZCommand = InputCommand,
      SelectCommand,
      ListCommand, etc
    end note
  activate Parser
  create XYZCommand
  Parser -> XYZCommand : new XYZCommand()
  activate XYZCommand
  note left
      Arguments for prepareXYZCommand()
      and XYZCommand() are omitted.
  end note
  XYZCommand --> Parser : XYZCommand
  deactivate XYZCommand
  Parser --> Parser : XYZCommand
  deactivate Parser
  <-- Parser : XYZCommand
else commandType is not valid
  <-- Parser : ParserException
end

@enduml
