upload
This commit is contained in:
65
src/main/java/hhn/temp/project/Task.java
Normal file
65
src/main/java/hhn/temp/project/Task.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package hhn.temp.project;
|
||||
|
||||
public class Task {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private TaskStatus taskStatus;
|
||||
private int taskID;
|
||||
private static int idCounter = 0;
|
||||
|
||||
public Task(String name, String description) {
|
||||
|
||||
if (name == null || description == null ) {
|
||||
|
||||
throw new IllegalArgumentException("Name/Description is null!");
|
||||
}
|
||||
if(name.isEmpty() || description.isEmpty()) {
|
||||
throw new IllegalArgumentException("Name/Description is empty!");
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.taskStatus = TaskStatus.OPEN;
|
||||
//TODO when DB then auto IDs
|
||||
this.taskID = idCounter++;
|
||||
}
|
||||
|
||||
public int getTaskID() {
|
||||
return taskID;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public TaskStatus getStatus() {
|
||||
return taskStatus;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
if (description == null ) {
|
||||
|
||||
throw new IllegalArgumentException("Description is null!");
|
||||
}
|
||||
if(description.isEmpty()) {
|
||||
throw new IllegalArgumentException("Description is empty!");
|
||||
}
|
||||
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setStatus(TaskStatus taskStatus) {
|
||||
if (taskStatus == null ) {
|
||||
|
||||
throw new IllegalArgumentException("TaskStatus is null!");
|
||||
}
|
||||
|
||||
this.taskStatus = taskStatus;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user