Skip to content

Conversation

@Shtramak
Copy link

@Shtramak Shtramak commented Apr 4, 2018

No description provided.

while (true) {
String command = view.read();
handler.handleCommand(command);
if (command.toLowerCase().equals("exit")) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем этот if, если есть команда exit?)


@Override
public void execute() {
if (databaseManager.hasConnection()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я поэтому сделал 2 метода с коннектом и без, чтобы не городить if else в каждой команде)

}

public void handleCommand(String strCommand) {
if (strCommand.toLowerCase().equals("help")) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Потом лучше, конечно, это в команду help вытащить)

}
}

private Command getCommandByName(String commandName) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А я не могу понять как отрабатывает connect, если как enum это одно слово connect, а как команда он 4 слова

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants