feature/tasks/enum-status-and-idgen #19
@ -9,7 +9,7 @@ class Task {
|
|||||||
private int id;
|
private int id;
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
private boolean completed = false;
|
private boolean completed;
|
||||||
private LocalDate createdAt;
|
private LocalDate createdAt;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
41
todo/src/main/java/ru/kamask/pet/TaskStatus.java
Normal file
41
todo/src/main/java/ru/kamask/pet/TaskStatus.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package ru.kamask.pet;
|
||||||
|
|
||||||
|
public enum TaskStatus {
|
||||||
|
NEW("Новое") {
|
||||||
|
@Override
|
||||||
|
String getColorCode() {
|
||||||
|
return "\u001B[32m";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
IN_PROGRESS("В работе") {
|
||||||
|
@Override
|
||||||
|
String getColorCode() {
|
||||||
|
return "\u001B[35m";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
COMPLETED("Сделано") {
|
||||||
|
@Override
|
||||||
|
String getColorCode() {
|
||||||
|
return "\u001B[34m";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
CANCELLED("Отменено") {
|
||||||
|
@Override
|
||||||
|
String getColorCode() {
|
||||||
|
return "\u001B[31m";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
abstract String getColorCode();
|
||||||
|
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
TaskStatus(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -14,7 +14,11 @@ public class TodoApp {
|
|||||||
TodoApp app = new TodoApp();
|
TodoApp app = new TodoApp();
|
||||||
taskManager = app.new TaskManager();
|
taskManager = app.new TaskManager();
|
||||||
|
|
||||||
app.run();
|
TaskStatus status = TaskStatus.valueOf("NEW");
|
||||||
|
|
||||||
|
System.out.println(status.getDescription());
|
||||||
|
|
||||||
|
// app.run();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user