edu.stanford.protege.webprotege.user.EmailAddress Maven / Gradle / Ivy
The newest version!
package edu.stanford.protege.webprotege.user;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Nonnull;
import java.io.Serializable;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Author: Matthew Horridge
* Stanford University
* Bio-Medical Informatics Research Group
* Date: 04/06/2012
*/
public class EmailAddress implements Serializable {
private String address;
private EmailAddress() {
}
@JsonCreator
public EmailAddress(@Nonnull String address) {
checkNotNull(address);
this.address = address;
}
public boolean isEmpty() {
return address.isEmpty();
}
@Nonnull
@JsonValue
public String getEmailAddress() {
return address;
}
@Override
public int hashCode() {
return address.hashCode();
}
@Override
public boolean equals(Object obj) {
if(obj == this) {
return true;
}
if(!(obj instanceof EmailAddress)) {
return false;
}
EmailAddress other = (EmailAddress) obj;
return address.equals(other.address);
}
@Override
public String toString() {
return toStringHelper("EmailAddress")
.addValue(address)
.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy