All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.mongoose.base.storage.CredentialImpl Maven / Gradle / Ivy

There is a newer version: 4.3.10
Show newest version
package com.emc.mongoose.base.storage;

/** Created by andrey on 14.03.17. */
public final class CredentialImpl implements Credential {

	private final String uid;
	private final String secret;

	protected CredentialImpl(final String uid, final String secret) {
		this.uid = uid;
		this.secret = secret;
	}

	@Override
	public final String getUid() {
		return uid;
	}

	@Override
	public final String getSecret() {
		return secret;
	}

	@Override
	public final boolean equals(final Object other) {

		if (!(other instanceof CredentialImpl)) {
			return false;
		}

		final CredentialImpl otherCred = (CredentialImpl) other;
		if (uid != null) {
			if (uid.equals(otherCred.uid)) {
				if (secret != null) {
					return secret.equals(otherCred.secret);
				} else if (otherCred.secret == null) {
					return true;
				}
			}
		} else {
			if (otherCred.uid == null) {
				if (secret != null) {
					return secret.equals(otherCred.secret);
				} else if (otherCred.secret == null) {
					return true;
				}
			}
		}
		return false;
	}

	@Override
	public final int hashCode() {
		return (uid == null ? 0 : uid.hashCode()) ^ (secret == null ? 0 : secret.hashCode());
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy