
com.cookingfox.chefling.api.command.MapInstanceCommand 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.exception.ContainerException;
public interface MapInstanceCommand {
/**
* Map `type` to a specific instance, which will be returned when `type` is requested. This is
* useful when `type` has dependencies (constructor parameters) that are not resolvable by the
* container (e.g. `int`, `boolean`). This instance will be processed by
* {@link CheflingContainer#createInstance(Class)}, to make sure the object is properly
* initialized. If a mapping for `type` already exists when this method is called, an exception
* will be thrown.
*
* @param type The type (class, interface) you want to map the instance of.
* @param instance The instance you want to store.
* @param Ensures the instance is of the correct type.
* @throws ContainerException when a mapping for `type` already exists.
*/
void mapInstance(Class type, T instance);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy