public int hashCode() {
   int result = (this.mechanism != null) ? this.mechanism.hashCode() : 0;
   result = 31 * result + this.userName.hashCode();
   result = 31 * result + this.source.hashCode();
   result = 31 * result + ((this.password != null) ? Arrays.hashCode(this.password) : 0);
   result = 31 * result + this.mechanismProperties.hashCode();
   return result;
 }
 public boolean equals(final Object o) {
   if (this == o) {
     return true;
   }
   if (o == null || this.getClass() != o.getClass()) {
     return false;
   }
   final MongoCredential that = (MongoCredential) o;
   if (this.mechanism != null) {
     if (this.mechanism.equals(that.mechanism)) {
       return this.mechanismProperties.equals(that.mechanismProperties)
           && Arrays.equals(this.password, that.password)
           && this.source.equals(that.source)
           && this.userName.equals(that.userName);
     }
   } else if (that.mechanism == null) {
     return this.mechanismProperties.equals(that.mechanismProperties)
         && Arrays.equals(this.password, that.password)
         && this.source.equals(that.source)
         && this.userName.equals(that.userName);
   }
   return false;
 }