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

edu.stanford.protege.webprotege.app.ApplicationLocation Maven / Gradle / Ivy

The newest version!
package edu.stanford.protege.webprotege.app;

import com.google.common.base.Objects;

import javax.annotation.Nonnull;

import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Matthew Horridge
 * Stanford Center for Biomedical Informatics Research
 * 18 Mar 2017
 */
public class ApplicationLocation {

    private String scheme;

    private String host;

    private String path;

    private int port;


    private ApplicationLocation() {
    }

    public ApplicationLocation(@Nonnull String scheme,
                               @Nonnull String host,
                               @Nonnull String path,
                               int port) {
        this.scheme = checkNotNull(scheme);
        this.host = checkNotNull(host);
        this.path = checkNotNull(path);
        this.port = port;
    }

    @Nonnull
    public String getScheme() {
        return scheme;
    }

    @Nonnull
    public String getHost() {
        return host;
    }

    @Nonnull
    public String getPath() {
        return path;
    }

    public int getPort() {
        return port;
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(scheme,
                                host,
                                path,
                                port);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof ApplicationLocation)) {
            return false;
        }
        ApplicationLocation other = (ApplicationLocation) obj;
        return this.scheme.equals(other.scheme)
                && this.host.equals(other.host)
                && this.path.equals(other.path)
                && this.port == other.port;
    }


    @Override
    public String toString() {
        return toStringHelper("ApplicationLocation" )
                .add("scheme", scheme)
                .add("host", host)
                .add("path", path)
                .add("port", port)
                .toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy