1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2013-2026 The Coveralls Maven Plugin Project Contributors:
5 * https://github.com/hazendaz/coveralls-maven-plugin/graphs/contributors
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25 package org.eluder.coveralls.maven.plugin.domain;
26
27 import com.fasterxml.jackson.annotation.JsonIgnore;
28 import com.fasterxml.jackson.annotation.JsonProperty;
29
30 import java.io.File;
31 import java.io.Serializable;
32 import java.util.List;
33
34 /**
35 * The Class Git.
36 */
37 public class Git implements JsonObject {
38
39 /** The Constant serialVersionUID. */
40 private static final long serialVersionUID = 1L;
41
42 /** The base dir. */
43 @JsonIgnore
44 private final File baseDir;
45
46 /** The head. */
47 @JsonProperty("head")
48 private final Head head;
49
50 /** The branch. */
51 @JsonProperty("branch")
52 private final String branch;
53
54 /** The remotes. */
55 @JsonProperty("remotes")
56 private final List<Remote> remotes;
57
58 /**
59 * Instantiates a new git.
60 *
61 * @param baseDir
62 * the base dir
63 * @param head
64 * the head
65 * @param branch
66 * the branch
67 * @param remotes
68 * the remotes
69 */
70 public Git(final File baseDir, final Head head, final String branch, final List<Remote> remotes) {
71 this.baseDir = baseDir;
72 this.head = head;
73 this.branch = branch;
74 this.remotes = remotes;
75 }
76
77 /**
78 * Gets the base dir.
79 *
80 * @return the base dir
81 */
82 public File getBaseDir() {
83 return this.baseDir;
84 }
85
86 /**
87 * Gets the head.
88 *
89 * @return the head
90 */
91 public Head getHead() {
92 return this.head;
93 }
94
95 /**
96 * Gets the branch.
97 *
98 * @return the branch
99 */
100 public String getBranch() {
101 return this.branch;
102 }
103
104 /**
105 * Gets the remotes.
106 *
107 * @return the remotes
108 */
109 public List<Remote> getRemotes() {
110 return this.remotes;
111 }
112
113 /**
114 * The Class Head.
115 */
116 public static class Head implements Serializable {
117
118 /** The Constant serialVersionUID. */
119 private static final long serialVersionUID = 1L;
120
121 /** The id. */
122 @JsonProperty("id")
123 private final String id;
124
125 /** The author name. */
126 @JsonProperty("author_name")
127 private final String authorName;
128
129 /** The author email. */
130 @JsonProperty("author_email")
131 private final String authorEmail;
132
133 /** The committer name. */
134 @JsonProperty("committer_name")
135 private final String committerName;
136
137 /** The committer email. */
138 @JsonProperty("committer_email")
139 private final String committerEmail;
140
141 /** The message. */
142 @JsonProperty("message")
143 private final String message;
144
145 /**
146 * Instantiates a new head.
147 *
148 * @param id
149 * the id
150 * @param authorName
151 * the author name
152 * @param authorEmail
153 * the author email
154 * @param committerName
155 * the committer name
156 * @param committerEmail
157 * the committer email
158 * @param message
159 * the message
160 */
161 public Head(final String id, final String authorName, final String authorEmail, final String committerName,
162 final String committerEmail, final String message) {
163 this.id = id;
164 this.authorName = authorName;
165 this.authorEmail = authorEmail;
166 this.committerName = committerName;
167 this.committerEmail = committerEmail;
168 this.message = message;
169 }
170
171 /**
172 * Gets the id.
173 *
174 * @return the id
175 */
176 public String getId() {
177 return this.id;
178 }
179
180 /**
181 * Gets the author name.
182 *
183 * @return the author name
184 */
185 public String getAuthorName() {
186 return this.authorName;
187 }
188
189 /**
190 * Gets the author email.
191 *
192 * @return the author email
193 */
194 public String getAuthorEmail() {
195 return this.authorEmail;
196 }
197
198 /**
199 * Gets the committer name.
200 *
201 * @return the committer name
202 */
203 public String getCommitterName() {
204 return this.committerName;
205 }
206
207 /**
208 * Gets the committer email.
209 *
210 * @return the committer email
211 */
212 public String getCommitterEmail() {
213 return this.committerEmail;
214 }
215
216 /**
217 * Gets the message.
218 *
219 * @return the message
220 */
221 public String getMessage() {
222 return this.message;
223 }
224 }
225
226 /**
227 * The Class Remote.
228 */
229 public static class Remote implements Serializable {
230
231 /** The Constant serialVersionUID. */
232 private static final long serialVersionUID = 1L;
233
234 /** The name. */
235 @JsonProperty("name")
236 private final String name;
237
238 /** The url. */
239 @JsonProperty("url")
240 private final String url;
241
242 /**
243 * Instantiates a new remote.
244 *
245 * @param name
246 * the name
247 * @param url
248 * the url
249 */
250 public Remote(final String name, final String url) {
251 this.name = name;
252 this.url = url;
253 }
254
255 /**
256 * Gets the name.
257 *
258 * @return the name
259 */
260 public String getName() {
261 return this.name;
262 }
263
264 /**
265 * Gets the url.
266 *
267 * @return the url
268 */
269 public String getUrl() {
270 return this.url;
271 }
272 }
273 }