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

io.securecodebox.persistence.defectdojo.http.ProxyConfig Maven / Gradle / Ivy

The newest version!
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0

package io.securecodebox.persistence.defectdojo.http;

import lombok.Builder;
import lombok.Value;

/**
 * Holds HTTP proxy configuration
 * 

* This class is immutable by design and therefor thread safe. As defaults it does not use |{@code null} to prevent null * pointer exceptions. It utilizes sane defaults (empty string or 0) to indicate a not set value. Also it introduces a * null-object to indicate a not-existing configuration. *

*/ @Value @Builder public class ProxyConfig { /** * Null pattern object. */ public static final ProxyConfig NULL = ProxyConfig.builder().build(); private static final String DEFAULT_STRING = ""; private static final int DEFAULT_INT = 0; /** * Username to authenticate on a proxy. *

* Defaults to empty string. *

*/ @Builder.Default String user = DEFAULT_STRING; /** * Password to authenticate on a proxy. *

* Defaults to empty string. *

*/ @Builder.Default String password = DEFAULT_STRING; /** * Host name of the proxy. *

* Defaults to empty string. *

*/ @Builder.Default String host = DEFAULT_STRING; /** * Port of the proxy. *

* Defaults to 0 (zero). *

*/ @Builder.Default int port = DEFAULT_INT; /** * configuration is considered complete if all values are not default values * * @return {@code true} if all values are set else {@code false} */ public boolean isComplete() { if (getUser().equals(DEFAULT_STRING)) { return false; } if (getPassword().equals(DEFAULT_STRING)) { return false; } if (getHost().equals(DEFAULT_STRING)) { return false; } if (getPort() == DEFAULT_INT) { return false; } return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy