
com.cookingfox.chefling.api.command.MapFactoryCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chefling-di-java Show documentation
Show all versions of chefling-di-java Show documentation
Chefling is a very minimal dependency injection container written in pure Java.
package com.cookingfox.chefling.api.command;
import com.cookingfox.chefling.api.CheflingContainer;
import com.cookingfox.chefling.api.CheflingFactory;
import com.cookingfox.chefling.api.exception.ContainerException;
public interface MapFactoryCommand {
/**
* Map `type` to a factory, which will create an instance of `type` when it is requested (by
* {@link CheflingContainer#createInstance(Class)}). Which specific instance will be created by
* the factory is up to the developer. The return value is validated by the container: if `null`
* or another unexpected value is returned, an exception will be thrown. If a mapping for `type`
* already exists when this method is called, an exception will be thrown.
*
* @param type The type (class, interface) of the object that will be created by the factory.
* @param factory A factory instance.
* @param Ensures a factory of the expected type is passed.
* @throws ContainerException when a mapping for `type` already exists.
* @see CheflingFactory
*/
void mapFactory(Class type, CheflingFactory factory);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy