|
| 1 | +package org.scm4j.vcs.api; |
| 2 | + |
| 3 | +public class VCSTag { |
| 4 | + private final String tagName; |
| 5 | + private final String tagMessage; |
| 6 | + private final String author; |
| 7 | + private final VCSCommit relatedCommit; |
| 8 | + |
| 9 | + public VCSTag(String tagName, String tagMessage, String author, VCSCommit relatedCommit) { |
| 10 | + this.tagName = tagName; |
| 11 | + this.tagMessage = tagMessage; |
| 12 | + this.author = author; |
| 13 | + this.relatedCommit = relatedCommit; |
| 14 | + } |
| 15 | + |
| 16 | + public String getTagName() { |
| 17 | + return tagName; |
| 18 | + } |
| 19 | + |
| 20 | + public String getTagMessage() { |
| 21 | + return tagMessage; |
| 22 | + } |
| 23 | + |
| 24 | + public String getAuthor() { |
| 25 | + return author; |
| 26 | + } |
| 27 | + |
| 28 | + public VCSCommit getRelatedCommit() { |
| 29 | + return relatedCommit; |
| 30 | + } |
| 31 | + |
| 32 | + @Override |
| 33 | + public String toString() { |
| 34 | + return "VCSTag [tagName=" + tagName + ", tagMessage=" + tagMessage + ", author=" + author + ", relatedCommit=" |
| 35 | + + relatedCommit + "]"; |
| 36 | + } |
| 37 | + |
| 38 | + @Override |
| 39 | + public int hashCode() { |
| 40 | + final int prime = 31; |
| 41 | + int result = 1; |
| 42 | + result = prime * result + ((author == null) ? 0 : author.hashCode()); |
| 43 | + result = prime * result + ((relatedCommit == null) ? 0 : relatedCommit.hashCode()); |
| 44 | + result = prime * result + ((tagMessage == null) ? 0 : tagMessage.hashCode()); |
| 45 | + result = prime * result + ((tagName == null) ? 0 : tagName.hashCode()); |
| 46 | + return result; |
| 47 | + } |
| 48 | + |
| 49 | + @Override |
| 50 | + public boolean equals(Object obj) { |
| 51 | + if (this == obj) |
| 52 | + return true; |
| 53 | + if (obj == null) |
| 54 | + return false; |
| 55 | + if (getClass() != obj.getClass()) |
| 56 | + return false; |
| 57 | + VCSTag other = (VCSTag) obj; |
| 58 | + if (author == null) { |
| 59 | + if (other.author != null) |
| 60 | + return false; |
| 61 | + } else if (!author.equals(other.author)) |
| 62 | + return false; |
| 63 | + if (relatedCommit == null) { |
| 64 | + if (other.relatedCommit != null) |
| 65 | + return false; |
| 66 | + } else if (!relatedCommit.equals(other.relatedCommit)) |
| 67 | + return false; |
| 68 | + if (tagMessage == null) { |
| 69 | + if (other.tagMessage != null) |
| 70 | + return false; |
| 71 | + } else if (!tagMessage.equals(other.tagMessage)) |
| 72 | + return false; |
| 73 | + if (tagName == null) { |
| 74 | + if (other.tagName != null) |
| 75 | + return false; |
| 76 | + } else if (!tagName.equals(other.tagName)) |
| 77 | + return false; |
| 78 | + return true; |
| 79 | + } |
| 80 | +} |
0 commit comments