View Javadoc
1   /*
2    * The MIT License (MIT)
3    *
4    * Copyright (c) 2013 - 2023, Tapio Rautonen
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy
7    * of this software and associated documentation files (the "Software"), to deal
8    * in the Software without restriction, including without limitation the rights
9    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10   * copies of the Software, and to permit persons to whom the Software is
11   * furnished to do so, subject to the following conditions:
12   *
13   * The above copyright notice and this permission notice shall be included in
14   * all copies or substantial portions of the Software.
15   *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22   * THE SOFTWARE.
23   */
24  package org.eluder.coveralls.maven.plugin.domain;
25  
26  import java.io.File;
27  import java.io.Serializable;
28  import java.util.List;
29  
30  import com.fasterxml.jackson.annotation.JsonIgnore;
31  import com.fasterxml.jackson.annotation.JsonProperty;
32  
33  public class Git implements JsonObject {
34  
35      private static final long serialVersionUID = 1L;
36  
37      @JsonIgnore
38      private final File baseDir;
39  
40      @JsonProperty("head")
41      private final Head head;
42  
43      @JsonProperty("branch")
44      private final String branch;
45  
46      @JsonProperty("remotes")
47      private final List<Remote> remotes;
48  
49      public Git(final File baseDir, final Head head, final String branch, final List<Remote> remotes) {
50          this.baseDir = baseDir;
51          this.head = head;
52          this.branch = branch;
53          this.remotes = remotes;
54      }
55  
56      public File getBaseDir() {
57          return baseDir;
58      }
59  
60      public Head getHead() {
61          return head;
62      }
63  
64      public String getBranch() {
65          return branch;
66      }
67  
68      public List<Remote> getRemotes() {
69          return remotes;
70      }
71  
72      public static class Head implements Serializable {
73          private static final long serialVersionUID = 1L;
74  
75          @JsonProperty("id")
76          private final String id;
77  
78          @JsonProperty("author_name")
79          private final String authorName;
80  
81          @JsonProperty("author_email")
82          private final String authorEmail;
83  
84          @JsonProperty("committer_name")
85          private final String committerName;
86  
87          @JsonProperty("committer_email")
88          private final String committerEmail;
89  
90          @JsonProperty("message")
91          private final String message;
92  
93          public Head(final String id, final String authorName, final String authorEmail, final String committerName, final String committerEmail, final String message) {
94              this.id = id;
95              this.authorName = authorName;
96              this.authorEmail = authorEmail;
97              this.committerName = committerName;
98              this.committerEmail = committerEmail;
99              this.message = message;
100         }
101 
102         public String getId() {
103             return id;
104         }
105 
106         public String getAuthorName() {
107             return authorName;
108         }
109 
110         public String getAuthorEmail() {
111             return authorEmail;
112         }
113 
114         public String getCommitterName() {
115             return committerName;
116         }
117 
118         public String getCommitterEmail() {
119             return committerEmail;
120         }
121 
122         public String getMessage() {
123             return message;
124         }
125     }
126 
127     public static class Remote implements Serializable {
128         private static final long serialVersionUID = 1L;
129 
130         @JsonProperty("name")
131         private final String name;
132 
133         @JsonProperty("url")
134         private final String url;
135 
136         public Remote(final String name, final String url) {
137             this.name = name;
138             this.url = url;
139         }
140 
141         public String getName() {
142             return name;
143         }
144 
145         public String getUrl() {
146             return url;
147         }
148     }
149 }