pl.project13.maven.git.AheadBehind Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of git-commit-id-plugin Show documentation
Show all versions of git-commit-id-plugin Show documentation
This plugin makes basic repository information available through maven resources. This can be used to display
"what version is this?" or "who has deployed this and when, from which branch?" information at runtime, making
it easy to find things like "oh, that isn't deployed yet, I'll test it tomorrow" and making both testers and
developers life easier. See https://github.com/git-commit-id/maven-git-commit-id-plugin
/*
* This file is part of git-commit-id-plugin by Konrad 'ktoso' Malawski
*
* git-commit-id-plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* git-commit-id-plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with git-commit-id-plugin. If not, see .
*/
package pl.project13.maven.git;
import java.util.Objects;
public class AheadBehind {
public static final AheadBehind NO_REMOTE = AheadBehind.of("NO_REMOTE", "NO_REMOTE");
private final String ahead;
private final String behind;
private AheadBehind(String ahead, String behind) {
this.ahead = ahead;
this.behind = behind;
}
public static AheadBehind of(int ahead, int behind) {
return new AheadBehind(String.valueOf(ahead), String.valueOf(behind));
}
public static AheadBehind of(String ahead, String behind) {
return new AheadBehind(ahead, behind);
}
public String ahead() {
return ahead;
}
public String behind() {
return behind;
}
@Override
public int hashCode() {
return Objects.hash(ahead, behind);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AheadBehind other = (AheadBehind) obj;
if (!Objects.equals(ahead, other.ahead)) {
return false;
}
if (!Objects.equals(behind, other.behind)) {
return false;
}
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy