Skip to content

Commit

Permalink
Added equals and hashcode methods in Password API.
Browse files Browse the repository at this point in the history
Signed-off-by: Maiero <matteo.maiero@eurotech.com>
  • Loading branch information
MMaiero authored and salvatore-coppola committed Nov 17, 2023
1 parent ee2c973 commit 4fb0b93
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
******************************************************************************/
package org.eclipse.kura.configuration;

import java.util.Arrays;

import org.osgi.annotation.versioning.ProviderType;

/**
Expand Down Expand Up @@ -42,4 +44,31 @@ public char[] getPassword() {
public String toString() {
return new String(this.passwordVal);
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(this.value);
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Password other = (Password) obj;
if (!Arrays.equals(this.value, other.value)) {
return false;
}
return true;
}

}

0 comments on commit 4fb0b93

Please sign in to comment.