io.datakernel.util.guice.OptionalInitializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of datakernel-boot Show documentation
Show all versions of datakernel-boot Show documentation
An intelligent way of booting complex applications and services according to their dependencies
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