-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask.java
53 lines (44 loc) · 1.35 KB
/
Task.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package taskapp;
public class Task {
private final String taskId;
private String name;
private String description;
public Task(String taskId, String name, String description) {
if (taskId == null || name == null || description == null) {
throw new IllegalArgumentException("Fields may not be empty.");
}
if (taskId.length() > 10 || name.length() > 20 || description.length() > 50) {
throw new IllegalArgumentException("Fields exceed the max length");
}
this.taskId = taskId;
this.name = name;
this.description = description;
}
public String getTaskId() {
return taskId;
}
public String getName() {
return name;
}
public void setName(String name) {
if (name == null || name.length() > 20) {
throw new IllegalArgumentException("Name is invalid.");
}
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
if (description == null || description.length() > 50) {
throw new IllegalArgumentException("Description invalid.");
}
this.description = description;
}
public String getTaskId1() {
return null;
}
public Object setTaskId(Object object) {
return null;
}
}