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

io.datakernel.di.core.BindingInfo Maven / Gradle / Ivy

Go to download

DataKernel has an extremely lightweight DI with ground-breaking design principles. It supports nested scopes, singletons, object factories, modules and plugins which allow to transform graph of dependencies at startup time without any reflection.

The newest version!
package io.datakernel.di.core;

import io.datakernel.di.util.LocationInfo;
import io.datakernel.di.util.MarkedBinding;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Set;

import static io.datakernel.di.core.BindingType.EAGER;
import static io.datakernel.di.core.BindingType.TRANSIENT;

public final class BindingInfo {
	private final Set dependencies;
	private final BindingType type;

	@Nullable
	private final LocationInfo location;

	public BindingInfo(Set dependencies, BindingType type, @Nullable LocationInfo location) {
		this.dependencies = dependencies;
		this.type = type;
		this.location = location;
	}

	public static BindingInfo from(MarkedBinding markedBinding) {
		Binding binding = markedBinding.getBinding();
		return new BindingInfo(binding.getDependencies(), markedBinding.getType(), binding.getLocation());
	}

	@NotNull
	public Set getDependencies() {
		return dependencies;
	}

	public BindingType getType() {
		return type;
	}

	@Nullable
	public LocationInfo getLocation() {
		return location;
	}

	@Override
	public String toString() {
		return (type == TRANSIENT ? "*" : type == EAGER ? "!" : "") + "Binding" + dependencies;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy