You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
753 B
26 lines
753 B
package com.example.datacollect.command;
|
|
|
|
import com.example.datacollect.repository.ArticleRepository;
|
|
import com.example.datacollect.view.ConsoleView;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
public class ListCommand implements Command {
|
|
private static final Logger logger = LoggerFactory.getLogger(ListCommand.class);
|
|
private final ConsoleView view;
|
|
|
|
public ListCommand(ConsoleView view) {
|
|
this.view = view;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "list";
|
|
}
|
|
|
|
@Override
|
|
public void execute(String[] args, ArticleRepository repository) {
|
|
logger.info("Listing {} articles", repository.size());
|
|
view.display(repository.getAll());
|
|
}
|
|
}
|
|
|