You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2026/06/08 08:33:49 UTC
(maven-scm) branch master updated: Add toString()/equals()/hashCode() for InfoItem
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-scm.git
The following commit(s) were added to refs/heads/master by this push:
new f31f94968 Add toString()/equals()/hashCode() for InfoItem
f31f94968 is described below
commit f31f94968fa2026bf5aa0e068aa4206e76323779
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Mon Mar 30 18:01:00 2026 +0200
Add toString()/equals()/hashCode() for InfoItem
---
.../apache/maven/scm/command/info/InfoItem.java | 83 ++++++++++++++++++++++
1 file changed, 83 insertions(+)
diff --git a/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java b/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java
index 1120d6440..8e8e2460c 100644
--- a/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java
+++ b/maven-scm-api/src/main/java/org/apache/maven/scm/command/info/InfoItem.java
@@ -20,6 +20,7 @@
import java.time.OffsetDateTime;
import java.time.temporal.TemporalAccessor;
+import java.util.Objects;
/**
* Encapsulates meta information about a file (or directory) being managed with an SCM.
@@ -156,4 +157,86 @@ public OffsetDateTime getLastChangedDateTime() {
public void setLastChangedDateTime(TemporalAccessor accessor) {
this.lastChangedDateTime = OffsetDateTime.from(accessor);
}
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("InfoItem [");
+ if (path != null) {
+ builder.append("path=").append(path).append(", ");
+ }
+ if (url != null) {
+ builder.append("url=").append(url).append(", ");
+ }
+ if (repositoryRoot != null) {
+ builder.append("repositoryRoot=").append(repositoryRoot).append(", ");
+ }
+ if (repositoryUUID != null) {
+ builder.append("repositoryUUID=").append(repositoryUUID).append(", ");
+ }
+ if (revision != null) {
+ builder.append("revision=").append(revision).append(", ");
+ }
+ if (nodeKind != null) {
+ builder.append("nodeKind=").append(nodeKind).append(", ");
+ }
+ if (schedule != null) {
+ builder.append("schedule=").append(schedule).append(", ");
+ }
+ if (lastChangedAuthor != null) {
+ builder.append("lastChangedAuthor=").append(lastChangedAuthor).append(", ");
+ }
+ if (lastChangedRevision != null) {
+ builder.append("lastChangedRevision=").append(lastChangedRevision).append(", ");
+ }
+ if (lastChangedDate != null) {
+ builder.append("lastChangedDate=").append(lastChangedDate).append(", ");
+ }
+ if (lastChangedDateTime != null) {
+ builder.append("lastChangedDateTime=").append(lastChangedDateTime);
+ }
+ builder.append("]");
+ return builder.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(
+ lastChangedAuthor,
+ lastChangedDate,
+ lastChangedDateTime,
+ lastChangedRevision,
+ nodeKind,
+ path,
+ repositoryRoot,
+ repositoryUUID,
+ revision,
+ schedule,
+ url);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ InfoItem other = (InfoItem) obj;
+ return Objects.equals(lastChangedAuthor, other.lastChangedAuthor)
+ && Objects.equals(lastChangedDate, other.lastChangedDate)
+ && Objects.equals(lastChangedDateTime, other.lastChangedDateTime)
+ && Objects.equals(lastChangedRevision, other.lastChangedRevision)
+ && Objects.equals(nodeKind, other.nodeKind)
+ && Objects.equals(path, other.path)
+ && Objects.equals(repositoryRoot, other.repositoryRoot)
+ && Objects.equals(repositoryUUID, other.repositoryUUID)
+ && Objects.equals(revision, other.revision)
+ && Objects.equals(schedule, other.schedule)
+ && Objects.equals(url, other.url);
+ }
}