Skip to content

Commit c7f6efb

Browse files
committed
First version of a unified model for all tutorials
1 parent 92a0661 commit c7f6efb

File tree

7 files changed

+166
-0
lines changed

7 files changed

+166
-0
lines changed

com.vogella.model.task/.classpath

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5+
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="output" path="bin"/>
7+
</classpath>

com.vogella.model.task/.project

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>com.vogella.model.task</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.pde.PluginNature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
</natures>
28+
</projectDescription>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Task
4+
Bundle-SymbolicName: com.vogella.model.task
5+
Bundle-Version: 1.0.0.qualifier
6+
Bundle-Vendor: VOGELLA
7+
Require-Bundle: org.eclipse.ui,
8+
org.eclipse.core.runtime
9+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.vogella.model.task;
2+
3+
public class MainTest {
4+
5+
public static void main(String[] args) {
6+
Task task = new TaskBuilder(5).setDescription("Hello").setSummary("Test").build();
7+
System.out.println(task);
8+
}
9+
10+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.vogella.model.task;
2+
3+
import java.util.Date;
4+
5+
public class Task {
6+
private final long id;
7+
private String summary = "";
8+
private String description = "";
9+
private boolean done = false;
10+
private Date dueDate;
11+
12+
public Task(long id) {
13+
this.id = id;
14+
}
15+
16+
public Task(long id, String summary, String description, boolean done,
17+
Date dueDate) {
18+
this.id = id;
19+
this.summary = summary;
20+
this.description = description;
21+
this.done = done;
22+
this.dueDate = dueDate;
23+
24+
}
25+
26+
public long getId() {
27+
return id;
28+
}
29+
30+
public String getSummary() {
31+
return summary;
32+
}
33+
34+
public void setSummary(String summary) {
35+
this.summary = summary;
36+
}
37+
38+
public String getDescription() {
39+
return description;
40+
}
41+
42+
public void setDescription(String description) {
43+
this.description = description;
44+
}
45+
46+
public boolean isDone() {
47+
return done;
48+
}
49+
50+
public void setDone(boolean done) {
51+
this.done = done;
52+
}
53+
54+
public Date getDueDate() {
55+
return dueDate;
56+
}
57+
58+
public void setDueDate(Date dueDate) {
59+
this.dueDate = dueDate;
60+
}
61+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.vogella.model.task;
2+
3+
import java.util.Date;
4+
5+
public class TaskBuilder {
6+
private final long id;
7+
private String summary = "";
8+
private String description = "";
9+
private boolean done = false;
10+
private Date dueDate;
11+
12+
public TaskBuilder(long id) {
13+
this.id = id;
14+
}
15+
16+
public TaskBuilder(long id, String summary, String description, boolean done,
17+
Date dueDate) {
18+
this.id = id;
19+
this.summary = summary;
20+
this.description = description;
21+
this.done = done;
22+
this.dueDate = dueDate;
23+
}
24+
25+
public TaskBuilder setSummary(String summary) {
26+
this.summary = summary;
27+
return this;
28+
}
29+
30+
public TaskBuilder setDescription(String description) {
31+
this.description = description;
32+
return this;
33+
}
34+
35+
public TaskBuilder setDone(boolean done) {
36+
this.done = done;
37+
return this;
38+
}
39+
40+
public TaskBuilder setDueDate(Date dueDate) {
41+
this.dueDate = dueDate;
42+
return this;
43+
}
44+
public Task build() {
45+
return new Task(id,summary, description,done, dueDate);
46+
}
47+
}

0 commit comments

Comments
 (0)