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

io.jexxa.jlegmed.core.BootstrapRegistry Maven / Gradle / Ivy

There is a newer version: 3.5.2
Show newest version
package io.jexxa.jlegmed.core;

import io.jexxa.jlegmed.core.filter.FilterProperties;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public final class BootstrapRegistry {

    private static final BootstrapRegistry INSTANCE = new BootstrapRegistry();

    private final List> failFastHandler = new ArrayList<>();
    private final List bootstrapHandler = new ArrayList<>();

    public static void registerFailFastHandler(Consumer propertiesHandler)
    {
        INSTANCE.failFastHandler.add(propertiesHandler);
    }

    public static void registerBootstrapHandler(Runnable bootStrapHandler)
    {
        INSTANCE.bootstrapHandler.add(bootStrapHandler);
    }


    public static void initFailFast(FilterProperties filterProperties)
    {
        INSTANCE.failFastHandler.forEach(element -> element.accept(filterProperties));
    }

    public static void bootstrapServices()
    {
        INSTANCE.bootstrapHandler.forEach(Runnable::run);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy