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

com.blade.ioc.Ioc Maven / Gradle / Ivy

There is a newer version: 2.0.15.RELEASE
Show newest version
package com.blade.ioc;

import com.blade.ioc.bean.BeanDefine;

import java.util.List;
import java.util.Set;

/**
 * IOC container, it provides an interface for registration and bean.
 *
 * @author biezhi
 * @since 1.5
 */
public interface Ioc {

    /**
     * Add bean to ioc container
     *
     * @param bean bean instance
     */
    void addBean(Object bean);

    /**
     * Add bean to ioc container
     *
     * @param name bean name
     * @param bean bean instance
     */
    void addBean(String name, Object bean);

    /**
     * Create bean by type, and register to ioc container
     *
     * @param type bean class type
     * @param   class Type
     * @return return no instance constructor
     */
     T addBean(Class type);

    Object createBean(Class type);

    /**
     * Set bean, e.g aop proxy
     *
     * @param type      bean class type
     * @param proxyBean bean instance by proxy
     */
    void setBean(Class type, Object proxyBean);

    /**
     * Get bean instance by name
     *
     * @param name bean name
     * @return return bean instance
     */
    Object getBean(String name);

    /**
     * Get bean instance by class type
     *
     * @param type class type
     * @param   type
     * @return return bean instance
     */
     T getBean(Class type);

    /**
     * Get ioc container bean defines
     *
     * @return ioc container bean defines
     */
    List getBeanDefines();

    /**
     * Get BeanDefine by bean type
     *
     * @param type bean class type
     * @return return BeanDefine instance
     */
    BeanDefine getBeanDefine(Class type);

    /**
     * Get ioc container all beans
     *
     * @return return bean list
     */
    List getBeans();

    /**
     * Get ioc bean names
     *
     * @return return bean name set
     */
    Set getBeanNames();

    /**
     * Remove bean by class type
     *
     * @param type bean class type
     */
    void remove(Class type);

    /**
     * Remove bean by name
     *
     * @param beanName bean name
     */
    void remove(String beanName);

    /**
     * Clean ioc container
     */
    void clearAll();

}