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

com.github.thorbenkuck.di.domain.provider.MultitonGenericIdentifiableProvider Maven / Gradle / Ivy

The newest version!
package com.github.thorbenkuck.di.domain.provider;

import com.github.thorbenkuck.di.runtime.WireRepository;
import org.jetbrains.annotations.NotNull;

import java.util.function.Function;

class MultitonGenericIdentifiableProvider implements IdentifiableProvider {

	@NotNull
	private final Function creationFunction;
	@NotNull
	private final Class[] wireTypes;
	@NotNull
	private final Class type;

	MultitonGenericIdentifiableProvider(
			@NotNull final Function creationFunction,
			@NotNull Class[] wireTypes,
			@NotNull Class type
	) {
		this.creationFunction = creationFunction;
		this.type = type;
		this.wireTypes = wireTypes;
	}

	@Override
	@NotNull
	public final Class type() {
		return type;
	}

	@Override
	@NotNull
	public final Class[] wiredTypes() {
		return wireTypes;
	}

	@Override
	public final boolean isSingleton() {
		return false;
	}

	@Override
	@NotNull
	public T get(@NotNull final WireRepository wiredRepository) {
		return creationFunction.apply(wiredRepository);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy