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

com.sap.it.commons.net.ProxyData Maven / Gradle / Ivy

The newest version!
package com.sap.it.commons.net;

import com.sap.it.commons.lang.Equals;
import com.sap.it.commons.lang.Hash;
import com.sap.it.commons.tools.StringTools;

public class ProxyData {
    private final String host;
    private final int port;
    private final String user;
    private final String password;

    public ProxyData(String host, int port) {
        this(host, port, null, null);
    }

    public ProxyData(String host, int port, String user, String password) {
        super();
        this.host = host;
        this.port = port;
        this.user = user;
        this.password = password;
    }

    private final static ProxyData EMPTY_INSTANCE = new ProxyData(null, -1, null, null);

    public static ProxyData createEmptyInstance() {
        return EMPTY_INSTANCE;
    }

    public String getHost() {
        return host;
    }

    public int getPort() {
        return port;
    }

    public String getUser() {
        return user;
    }

    public String getPassword() {
        return password;
    }

    public boolean isEmpty() {
        return StringTools.isEmpty(this.host);
    }

    public boolean isNotEmpty() {
        return StringTools.hasContent(this.host);
    }

    @Override
    public int hashCode() {
        return Hash.hash(host, port, user, password);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof ProxyData)) {
            return false;
        }

        ProxyData other = (ProxyData) obj;
        return Equals.equals(host, other.host) && //
                Equals.equals(port, other.port) && //
                Equals.equals(user, other.user) && //
                Equals.equals(password, other.password);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy