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

com.hp.octane.integrations.services.configurationparameters.FortifySSCFetchTimeoutParameter Maven / Gradle / Ivy

There is a newer version: 2.24.3.5
Show newest version
package com.hp.octane.integrations.services.configurationparameters;

import com.hp.octane.integrations.services.configurationparameters.factory.ConfigurationParameter;

public class FortifySSCFetchTimeoutParameter implements ConfigurationParameter {
    public static final String KEY = "FORTIFY_SSC_FETCH_TIMEOUT";
    public static final int DEFAULT_TIMEOUT = 12;
    private int timeout;

    private FortifySSCFetchTimeoutParameter(int timeout) {
        this.timeout = timeout;
    }


    public static FortifySSCFetchTimeoutParameter create(String rawValue) {
        if (rawValue == null || rawValue.trim().isEmpty()) {
            throw new IllegalArgumentException("Parameter " + KEY + " : Expected non-empty integer value");
        }

        int value;
        try {
            value = Integer.parseInt(rawValue);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Parameter " + KEY + " : Expected integer value");
        }

        if (value <= 0 || value > 12) {
            throw new IllegalArgumentException("Parameter " + KEY + " : Expected integer value. The valid values are 1-12.");
        }

        return new FortifySSCFetchTimeoutParameter(value);
    }

    @Override
    public String getKey() {
        return KEY;
    }

    public int getTimeout() {
        return timeout;
    }

    @Override
    public String getRawValue() {
        return Integer.toString(timeout);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy