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

host.anzo.core.startup.StartupInstance Maven / Gradle / Ivy

package host.anzo.core.startup;

import lombok.extern.slf4j.Slf4j;

import javax.annotation.Nullable;
import java.util.*;

/**
 * @author ANZO
 */
@Slf4j
public class StartupInstance> {
	private final HashMap>> startTable = new HashMap<>();

	void put(SL level, StartModule module) {
		List> invokes = startTable.computeIfAbsent(level, k -> new ArrayList<>());
		invokes.add(module);
	}

	protected Collection>>> getAll() {
		return startTable.entrySet();
	}

	protected @Nullable List> get(SL level) {
		return startTable.getOrDefault(level, null);
	}
	
	void runLevel(SL level) {
		final List> list = startTable.get(level);
		if(list == null) {
			return;
		}

		list.forEach(StartModule::init);
	}

	boolean levelExists(SL level) {
		return startTable.get(level) != null && !startTable.get(level).isEmpty();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy