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

com.cookingfox.chefling.api.command.MapInstanceCommand Maven / Gradle / Ivy

Go to download

Chefling is a very minimal dependency injection container written in pure Java.

There is a newer version: 7.1.1
Show newest version
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