package com.todomvc.shared.command.todo;
import static com.google.common.base.Preconditions.checkNotNull;
import com.todomvc.shared.command.BulkSetterCommand;
import com.todomvc.shared.model.ToDo;
import com.todomvc.shared.model.ToDoList;
BulkSetterCommand that set the completion status of every task in a list of tasks.
Data carried:
public class SetCompletedToDoListCommand extends BulkSetterCommand<Boolean, ToDo, ToDoList> {
protected SetCompletedToDoListCommand() {
}
public SetCompletedToDoListCommand(ToDoList list, boolean completed) {
super(checkNotNull(list).getId(), completed, ToDoListCommandExecutor.TYPE);
}
@Override
public boolean isEager() {
return true;
}
@Override
protected void setValue(ToDo toDo, Boolean completed) {
checkNotNull(toDo);
toDo.setCompleted(completed);
}
public boolean getCompleted() {
return super.getValue();
}
}