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

org.xillium.gear.auth.Credential Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package org.xillium.gear.auth;

import org.xillium.data.DataObject;


/**
 * Service description.
 */
public class Credential implements DataObject, Comparable {
	public String id;
	public String password;

	public Credential() {
	}

	public Credential(String id, String pass) {
        if (id == null || pass == null) {
            throw new IllegalArgumentException("MissingIdentityOrPassword");
        }
		this.id = id;
		this.password = pass;
	}

    @Override
    public int compareTo(Credential o) {
        int c = id.compareTo(o.id);
        return (c == 0) ? password.compareTo(o.password) : c;
    }

    @Override
    public boolean equals(Object o) {
        return (o instanceof Credential) && compareTo((Credential)o) == 0;
    }

    @Override
    public int hashCode() {
        return (id + password).hashCode();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy