Skip to content

Commit 40b6d1f

Browse files
committed
Added equals and hashcode methods in Password API.
Signed-off-by: Maiero <[email protected]>
1 parent bbe229b commit 40b6d1f

File tree

1 file changed

+29
-0
lines changed
  • kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/configuration

1 file changed

+29
-0
lines changed

kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/configuration/Password.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
******************************************************************************/
1313
package org.eclipse.kura.configuration;
1414

15+
import java.util.Arrays;
16+
1517
import org.osgi.annotation.versioning.ProviderType;
1618

1719
/**
@@ -42,4 +44,31 @@ public char[] getPassword() {
4244
public String toString() {
4345
return new String(this.passwordVal);
4446
}
47+
48+
@Override
49+
public int hashCode() {
50+
final int prime = 31;
51+
int result = 1;
52+
result = prime * result + Arrays.hashCode(this.value);
53+
return result;
54+
}
55+
56+
@Override
57+
public boolean equals(Object obj) {
58+
if (this == obj) {
59+
return true;
60+
}
61+
if (obj == null) {
62+
return false;
63+
}
64+
if (getClass() != obj.getClass()) {
65+
return false;
66+
}
67+
Password other = (Password) obj;
68+
if (!Arrays.equals(this.value, other.value)) {
69+
return false;
70+
}
71+
return true;
72+
}
73+
4574
}

0 commit comments

Comments
 (0)