aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SourceRevision.java
diff options
context:
space:
mode:
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SourceRevision.java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SourceRevision.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SourceRevision.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SourceRevision.java
new file mode 100644
index 00000000000..9c10e0dc153
--- /dev/null
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/SourceRevision.java
@@ -0,0 +1,48 @@
+// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.vespa.hosted.controller.application;
+
+import java.util.Objects;
+
+/**
+ * A revision in a source repository
+ *
+ * @author bratseth
+ */
+public class SourceRevision {
+
+ private final String repository;
+ private final String branch;
+ private final String commit;
+
+ public SourceRevision(String repository, String branch, String commit) {
+ Objects.requireNonNull(repository, "repository cannot be null");
+ Objects.requireNonNull(branch, "branch cannot be null");
+ Objects.requireNonNull(commit, "commit cannot be null");
+ this.repository = repository;
+ this.branch = branch;
+ this.commit = commit;
+ }
+
+ public String repository() { return repository; }
+ public String branch() { return branch; }
+ public String commit() { return commit; }
+
+ @Override
+ public int hashCode() { return Objects.hash(repository, branch, commit); }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if ( ! (o instanceof SourceRevision)) return false;
+
+ SourceRevision other = (SourceRevision)o;
+ return this.repository.equals(other.repository) &&
+ this.branch.equals(other.branch) &&
+ this.commit.equals(other.commit);
+ }
+
+ @Override
+ public String toString() { return "source revision of repository '" + repository +
+ "', branch '" + branch + "' with commit '" + commit + "'"; }
+
+}