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

org.zalando.riptide.autoconfigure.Dependencies Maven / Gradle / Ivy

There is a newer version: 4.3.0
Show newest version
package org.zalando.riptide.autoconfigure;

import java.util.Optional;
import java.util.function.Supplier;

import static org.springframework.util.ClassUtils.getDefaultClassLoader;
import static org.springframework.util.ClassUtils.isPresent;

final class Dependencies {

    private Dependencies() {
        
    }

    static void ifPresent(final String name, final Runnable runnable) {
        ifPresent(name, () -> {
            runnable.run();
            return null;
        });
    }

    static  Optional ifPresent(final String name, final Supplier supplier) {
        if (isPresent(name, getDefaultClassLoader())) {
            return Optional.ofNullable(supplier.get());
        } else {
            return Optional.empty();
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy