|
1 | | -package org.gitlab4j.api.webhook; |
2 | | - |
3 | | -import java.util.Date; |
4 | | -import java.util.List; |
5 | | - |
6 | | -import org.gitlab4j.api.models.Assignee; |
7 | | -import org.gitlab4j.api.utils.JacksonJson; |
8 | | - |
9 | | -public class EventChanges { |
10 | | - |
11 | | - private ChangeContainer<Date> updatedAt; |
12 | | - private ChangeContainer<Integer> updatedById; |
13 | | - private ChangeContainer<Date> dueDate; |
14 | | - private ChangeContainer<Integer> milestoneId; |
15 | | - private ChangeContainer<List<EventLabel>> labels; |
16 | | - private ChangeContainer<List<Assignee>> assignees; |
17 | | - private ChangeContainer<Integer> totalTimeSpent; |
18 | | - private ChangeContainer<Boolean> confidential; |
19 | | - |
20 | | - public ChangeContainer<Date> getUpdatedAt() { |
21 | | - return updatedAt; |
22 | | - } |
23 | | - |
24 | | - public void setUpdatedAt(ChangeContainer<Date> updatedAt) { |
25 | | - this.updatedAt = updatedAt; |
26 | | - } |
27 | | - |
28 | | - public ChangeContainer<Integer> getUpdatedById() { |
29 | | - return updatedById; |
30 | | - } |
31 | | - |
32 | | - public void setUpdatedById(ChangeContainer<Integer> updatedById) { |
33 | | - this.updatedById = updatedById; |
34 | | - } |
35 | | - |
36 | | - public ChangeContainer<Date> getDueDate() { |
37 | | - return dueDate; |
38 | | - } |
39 | | - |
40 | | - public void setDueDate(ChangeContainer<Date> dueDate) { |
41 | | - this.dueDate = dueDate; |
42 | | - } |
43 | | - |
44 | | - public ChangeContainer<Integer> getMilestoneId() { |
45 | | - return milestoneId; |
46 | | - } |
47 | | - |
48 | | - public void setMilestoneId(ChangeContainer<Integer> milestoneId) { |
49 | | - this.milestoneId = milestoneId; |
50 | | - } |
51 | | - |
52 | | - public ChangeContainer<List<EventLabel>> getLabels() { |
53 | | - return labels; |
54 | | - } |
55 | | - |
56 | | - public void setLabels(ChangeContainer<List<EventLabel>> labels) { |
57 | | - this.labels = labels; |
58 | | - } |
59 | | - |
60 | | - public ChangeContainer<List<Assignee>> getAssignees() { |
61 | | - return assignees; |
62 | | - } |
63 | | - |
64 | | - public void setAssignees(ChangeContainer<List<Assignee>> assignees) { |
65 | | - this.assignees = assignees; |
66 | | - } |
67 | | - |
68 | | - public ChangeContainer<Integer> getTotalTimeSpent() { |
69 | | - return totalTimeSpent; |
70 | | - } |
71 | | - |
72 | | - public void setTotalTimeSpent(ChangeContainer<Integer> totalTimeSpent) { |
73 | | - this.totalTimeSpent = totalTimeSpent; |
74 | | - } |
75 | | - |
76 | | - public ChangeContainer<Boolean> getConfidential() { |
77 | | - return confidential; |
78 | | - } |
79 | | - |
80 | | - public void setConfidential(ChangeContainer<Boolean> confidential) { |
81 | | - this.confidential = confidential; |
82 | | - } |
83 | | - |
84 | | - @Override |
85 | | - public String toString() { |
86 | | - return (JacksonJson.toJsonString(this)); |
87 | | - } |
88 | | -} |
| 1 | +package org.gitlab4j.api.webhook; |
| 2 | + |
| 3 | +import java.util.Date; |
| 4 | +import java.util.LinkedHashMap; |
| 5 | +import java.util.List; |
| 6 | +import java.util.Map; |
| 7 | + |
| 8 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 9 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 10 | +import org.gitlab4j.api.models.Assignee; |
| 11 | +import org.gitlab4j.api.utils.JacksonJson; |
| 12 | + |
| 13 | +public class EventChanges { |
| 14 | + |
| 15 | + private ChangeContainer<String> state; |
| 16 | + private ChangeContainer<Date> updatedAt; |
| 17 | + private ChangeContainer<Integer> updatedById; |
| 18 | + private ChangeContainer<Date> dueDate; |
| 19 | + private ChangeContainer<Integer> milestoneId; |
| 20 | + private ChangeContainer<List<EventLabel>> labels; |
| 21 | + private ChangeContainer<List<Assignee>> assignees; |
| 22 | + private ChangeContainer<Integer> totalTimeSpent; |
| 23 | + private ChangeContainer<Boolean> confidential; |
| 24 | + private LinkedHashMap<String, ChangeContainer<Object>> otherProperties = new LinkedHashMap<>(); |
| 25 | + |
| 26 | + public ChangeContainer<Date> getUpdatedAt() { |
| 27 | + return updatedAt; |
| 28 | + } |
| 29 | + |
| 30 | + public void setUpdatedAt(ChangeContainer<Date> updatedAt) { |
| 31 | + this.updatedAt = updatedAt; |
| 32 | + } |
| 33 | + |
| 34 | + public ChangeContainer<Integer> getUpdatedById() { |
| 35 | + return updatedById; |
| 36 | + } |
| 37 | + |
| 38 | + public void setUpdatedById(ChangeContainer<Integer> updatedById) { |
| 39 | + this.updatedById = updatedById; |
| 40 | + } |
| 41 | + |
| 42 | + public ChangeContainer<Date> getDueDate() { |
| 43 | + return dueDate; |
| 44 | + } |
| 45 | + |
| 46 | + public void setDueDate(ChangeContainer<Date> dueDate) { |
| 47 | + this.dueDate = dueDate; |
| 48 | + } |
| 49 | + |
| 50 | + public ChangeContainer<Integer> getMilestoneId() { |
| 51 | + return milestoneId; |
| 52 | + } |
| 53 | + |
| 54 | + public void setMilestoneId(ChangeContainer<Integer> milestoneId) { |
| 55 | + this.milestoneId = milestoneId; |
| 56 | + } |
| 57 | + |
| 58 | + public ChangeContainer<List<EventLabel>> getLabels() { |
| 59 | + return labels; |
| 60 | + } |
| 61 | + |
| 62 | + public void setLabels(ChangeContainer<List<EventLabel>> labels) { |
| 63 | + this.labels = labels; |
| 64 | + } |
| 65 | + |
| 66 | + public ChangeContainer<List<Assignee>> getAssignees() { |
| 67 | + return assignees; |
| 68 | + } |
| 69 | + |
| 70 | + public void setAssignees(ChangeContainer<List<Assignee>> assignees) { |
| 71 | + this.assignees = assignees; |
| 72 | + } |
| 73 | + |
| 74 | + public ChangeContainer<Integer> getTotalTimeSpent() { |
| 75 | + return totalTimeSpent; |
| 76 | + } |
| 77 | + |
| 78 | + public void setTotalTimeSpent(ChangeContainer<Integer> totalTimeSpent) { |
| 79 | + this.totalTimeSpent = totalTimeSpent; |
| 80 | + } |
| 81 | + |
| 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 | + |
| 98 | + public <T> ChangeContainer<T> get(String property){ |
| 99 | + if(otherProperties.containsKey(property)){ |
| 100 | + try { |
| 101 | + final ChangeContainer<Object> container = otherProperties.get(property); |
| 102 | + //noinspection unchecked It's duty from caller to be sure to do that |
| 103 | + return container != null ? (ChangeContainer<T>) container : null; |
| 104 | + } catch (ClassCastException e) { |
| 105 | + return null; |
| 106 | + } |
| 107 | + } else { |
| 108 | + return null; |
| 109 | + } |
| 110 | + } |
| 111 | + |
| 112 | + @JsonAnyGetter |
| 113 | + public Map<String, ChangeContainer<Object>> any() { |
| 114 | + return this.otherProperties; |
| 115 | + } |
| 116 | + |
| 117 | + @JsonAnySetter |
| 118 | + public void set(String name, ChangeContainer<Object> value) { |
| 119 | + otherProperties.put(name, value); |
| 120 | + } |
| 121 | + |
| 122 | + @Override |
| 123 | + public String toString() { |
| 124 | + return (JacksonJson.toJsonString(this)); |
| 125 | + } |
| 126 | +} |
0 commit comments