10
10
@ XStreamAlias (BuildInfoFields .VCS )
11
11
public class Vcs implements Serializable {
12
12
private String revision = "" ;
13
+ private String branch = "" ;
13
14
private String url = "" ;
14
15
15
16
public Vcs () {
@@ -20,6 +21,11 @@ public Vcs(String vcsUrl, String vcsRevision) {
20
21
this .setRevision (vcsRevision );
21
22
}
22
23
24
+ public Vcs (String vcsUrl , String vcsRevision , String branch ) {
25
+ this (vcsUrl , vcsRevision );
26
+ this .branch = branch ;
27
+ }
28
+
23
29
public String getRevision () {
24
30
return revision ;
25
31
}
@@ -28,6 +34,14 @@ public void setRevision(String revision) {
28
34
this .revision = revision ;
29
35
}
30
36
37
+ public String getBranch () {
38
+ return branch ;
39
+ }
40
+
41
+ public void setBranch (String branch ) {
42
+ this .branch = branch ;
43
+ }
44
+
31
45
public String getUrl () {
32
46
return this .url ;
33
47
}
@@ -38,7 +52,8 @@ public void setUrl(String url) {
38
52
39
53
@ Override
40
54
public String toString () {
41
- return "revision= '" + revision + '\'' +
55
+ return "revision='" + revision + '\'' +
56
+ ", branch='" + branch + '\'' +
42
57
", url='" + url + '\'' ;
43
58
}
44
59
@@ -52,18 +67,18 @@ public boolean equals(Object o) {
52
67
}
53
68
54
69
Vcs that = (Vcs ) o ;
55
- return Objects .equals (revision , that .revision ) && Objects .equals (url , that .url );
70
+ return Objects .equals (revision , that .revision ) &&
71
+ Objects .equals (branch , that .branch ) &&
72
+ Objects .equals (url , that .url );
56
73
}
57
74
58
75
@ Override
59
76
public int hashCode () {
60
- int result = (revision != null ? revision .hashCode () : 0 );
61
- result = 31 * result + (url != null ? url .hashCode () : 0 );
62
- return result ;
77
+ return Objects .hash (revision , branch , url );
63
78
}
64
79
65
80
@ JsonIgnore
66
81
public boolean isEmpty () {
67
- return StringUtils .isEmpty (this . getRevision ()) && StringUtils .isEmpty (this . getUrl ());
82
+ return StringUtils .isEmpty (getRevision ()) && StringUtils .isEmpty (getBranch ()) && StringUtils . isEmpty ( getUrl ());
68
83
}
69
84
}
0 commit comments