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

com.farao_community.farao.cse.adapter.app.GetUrlUtil Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2024, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.farao_community.farao.cse.adapter.app;

import java.util.Map;
import java.util.Optional;

/**
 * @author Daniel THIRION {@literal }
 */
public final class GetUrlUtil {

    private GetUrlUtil() {
        // private constructor to hide implicit one
    }

    static String getUrlOrThrow(final Map processFileUrlByType,
                                final FileType type) {
        return Optional.ofNullable(processFileUrlByType.get(type.getName())).orElseThrow(() -> new CseAdapterException(type.getName() + " type not found"));
    }

    static String getUrlOrEmpty(final Map processFileUrlByType,
                                final FileType type) {
        return Optional.ofNullable(processFileUrlByType.get(type.getName())).orElse("");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy