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

io.datakernel.util.guice.OptionalInitializer Maven / Gradle / Ivy

Go to download

An intelligent way of booting complex applications and services according to their dependencies

There is a newer version: 3.1.0
Show newest version
package io.datakernel.util.guice;

import com.google.inject.Inject;
import io.datakernel.util.Initializable;
import io.datakernel.util.Initializer;

import java.util.Set;

public final class OptionalInitializer> implements Initializer {
	@Inject(optional = true)
	private Initializer initializer;

	@Inject(optional = true)
	private Set> initializers;

	public boolean isPresent() {
		return initializer != null || (initializers != null && !initializers.isEmpty());
	}

	@Override
	public void accept(T value) {
		if (initializer != null) {
			initializer.accept(value);
		}
		if (initializers != null) {
			for (Initializer initializer : initializers) {
				initializer.accept(value);
			}
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy