Skip to content

Commit c15bcb5

Browse files
committed
Mods related to making EventChanges abstract (#362).
1 parent 78c3a0c commit c15bcb5

File tree

3 files changed

+52
-32
lines changed

3 files changed

+52
-32
lines changed

src/main/java/org/gitlab4j/api/webhook/EventChanges.java

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,36 @@
1010
import org.gitlab4j.api.models.Assignee;
1111
import org.gitlab4j.api.utils.JacksonJson;
1212

13-
public class EventChanges {
13+
public abstract class EventChanges {
1414

15-
private ChangeContainer<String> state;
15+
private ChangeContainer<Integer> authorId;
16+
private ChangeContainer<Date> createdAt;
1617
private ChangeContainer<Date> updatedAt;
1718
private ChangeContainer<Integer> updatedById;
18-
private ChangeContainer<Date> dueDate;
19+
private ChangeContainer<String> title;
20+
private ChangeContainer<String> description;
21+
private ChangeContainer<String> state;
1922
private ChangeContainer<Integer> milestoneId;
2023
private ChangeContainer<List<EventLabel>> labels;
2124
private ChangeContainer<List<Assignee>> assignees;
2225
private ChangeContainer<Integer> totalTimeSpent;
23-
private ChangeContainer<Boolean> confidential;
24-
private LinkedHashMap<String, ChangeContainer<Object>> otherProperties = new LinkedHashMap<>();
26+
private Map<String, ChangeContainer<Object>> otherProperties = new LinkedHashMap<>();
27+
28+
public ChangeContainer<Integer> getAuthorId() {
29+
return authorId;
30+
}
31+
32+
public void setAuthorId(ChangeContainer<Integer> authorId) {
33+
this.authorId = authorId;
34+
}
35+
36+
public ChangeContainer<Date> getCreatedAt() {
37+
return createdAt;
38+
}
39+
40+
public void setCreatedAt(ChangeContainer<Date> createdAt) {
41+
this.createdAt = createdAt;
42+
}
2543

2644
public ChangeContainer<Date> getUpdatedAt() {
2745
return updatedAt;
@@ -39,12 +57,28 @@ public void setUpdatedById(ChangeContainer<Integer> updatedById) {
3957
this.updatedById = updatedById;
4058
}
4159

42-
public ChangeContainer<Date> getDueDate() {
43-
return dueDate;
60+
public ChangeContainer<String> getTitle() {
61+
return title;
62+
}
63+
64+
public void setTitle(ChangeContainer<String> title) {
65+
this.title = title;
66+
}
67+
68+
public ChangeContainer<String> getDescription() {
69+
return description;
4470
}
4571

46-
public void setDueDate(ChangeContainer<Date> dueDate) {
47-
this.dueDate = dueDate;
72+
public void setDescription(ChangeContainer<String> description) {
73+
this.description = description;
74+
}
75+
76+
public ChangeContainer<String> getState() {
77+
return state;
78+
}
79+
80+
public void setState(ChangeContainer<String> state) {
81+
this.state = state;
4882
}
4983

5084
public ChangeContainer<Integer> getMilestoneId() {
@@ -79,27 +113,13 @@ public void setTotalTimeSpent(ChangeContainer<Integer> totalTimeSpent) {
79113
this.totalTimeSpent = totalTimeSpent;
80114
}
81115

82-
public ChangeContainer<Boolean> getConfidential() {
83-
return confidential;
84-
}
85-
86-
public void setConfidential(ChangeContainer<Boolean> confidential) {
87-
this.confidential = confidential;
88-
}
89-
90-
public ChangeContainer<String> getState() {
91-
return state;
92-
}
93-
94-
public void setState(ChangeContainer<String> state) {
95-
this.state = state;
96-
}
97-
116+
@SuppressWarnings("unchecked")
98117
public <T> ChangeContainer<T> get(String property){
118+
99119
if(otherProperties.containsKey(property)){
100120
try {
101121
final ChangeContainer<Object> container = otherProperties.get(property);
102-
//noinspection unchecked It's duty from caller to be sure to do that
122+
// noinspection unchecked : It's duty from caller to be sure to do that
103123
return container != null ? (ChangeContainer<T>) container : null;
104124
} catch (ClassCastException e) {
105125
return null;

src/main/java/org/gitlab4j/api/webhook/IssueEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class IssueEvent extends AbstractEvent {
1818
private List<Assignee> assignees;
1919
private Assignee assignee;
2020
private List<EventLabel> labels;
21-
private EventChanges changes;
21+
private IssueChanges changes;
2222

2323
public String getObjectKind() {
2424
return (OBJECT_KIND);
@@ -77,11 +77,11 @@ public void setLabels(List<EventLabel> labels) {
7777
this.labels = labels;
7878
}
7979

80-
public EventChanges getChanges() {
80+
public IssueChanges getChanges() {
8181
return changes;
8282
}
8383

84-
public void setChanges(EventChanges changes) {
84+
public void setChanges(IssueChanges changes) {
8585
this.changes = changes;
8686
}
8787

src/main/java/org/gitlab4j/api/webhook/MergeRequestEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class MergeRequestEvent extends AbstractEvent {
1515
private EventRepository repository;
1616
private ObjectAttributes objectAttributes;
1717
private List<EventLabel> labels;
18-
private EventChanges changes;
18+
private MergeRequestChanges changes;
1919

2020
public String getObjectKind() {
2121
return (OBJECT_KIND);
@@ -66,11 +66,11 @@ public void setLabels(List<EventLabel> labels) {
6666
this.labels = labels;
6767
}
6868

69-
public EventChanges getChanges() {
69+
public MergeRequestChanges getChanges() {
7070
return changes;
7171
}
7272

73-
public void setChanges(EventChanges changes) {
73+
public void setChanges(MergeRequestChanges changes) {
7474
this.changes = changes;
7575
}
7676

0 commit comments

Comments
 (0)