aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2018-04-23 14:22:51 +0200
committerBjørn Christian Seime <bjorncs@oath.com>2018-04-24 16:10:18 +0200
commit04002b8760c2061e03285be71b353de3f502fa93 (patch)
treec4844d11aa0516212b1f0522d2953c1e79d46c95 /node-repository
parent29d894be652512bf2e44ce57ac126a35fb1985e1 (diff)
Implement toString, equals and hashCode for NodePrincipal
Diffstat (limited to 'node-repository')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/filter/NodePrincipal.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/filter/NodePrincipal.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/filter/NodePrincipal.java
index cc95945c495..62d161a20df 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/filter/NodePrincipal.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/filter/NodePrincipal.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.provision.restapi.v2.filter;
import java.security.Principal;
import java.security.cert.X509Certificate;
import java.util.List;
+import java.util.Objects;
import java.util.Optional;
/**
@@ -66,4 +67,27 @@ public class NodePrincipal implements Principal {
public enum Type { ATHENZ, LEGACY }
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ NodePrincipal principal = (NodePrincipal) o;
+ return Objects.equals(identityName, principal.identityName) &&
+ Objects.equals(hostname, principal.hostname) &&
+ type == principal.type;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(identityName, hostname, type);
+ }
+
+ @Override
+ public String toString() {
+ return "NodePrincipal{" +
+ "identityName='" + identityName + '\'' +
+ ", hostname='" + hostname + '\'' +
+ ", type=" + type +
+ '}';
+ }
}