Package tigase.kernel.core

## Class BeanConfigBuilder

- java.lang.Object
- - tigase.kernel.core.BeanConfigBuilder

-     public class BeanConfigBuilder
      extends java.lang.Object

  Builder to help register beans in Kernel.

  Usage:

        // If Bean1.class is annotated by @Bean annotation.
        registerBean(Bean1.class).exec();

        // If Bean2 isn't annotated or should be registered with different name.
        krnl.registerBean("bean2").asClass(Bean2.class).exec();

        // To register already created variable bean4 as bean "bean4".
        krnl.registerBean("bean4").asInstance(bean4).exec();

        // If Bean5 have to been created by Bean5Factory.
        krnl.registerBean("bean5").asClass(Bean5.class).withFactory(Bean5Factory.class).exec();

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.util.logging.Logger` | `log` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `BeanConfigBuilder` | `asClass​(java.lang.Class<?> cls)` | Registers bean as type to be created when it will be required.
    `BeanConfigBuilder` | `asInstance​(java.lang.Object bean)` | Registers class instance as bean.
    `void` | `exec()` | Finishing registration of bean.
    `BeanConfig` | `execWithoutInject()` |
    `BeanConfigBuilder` | `exportable()` | Mark bean as 'exportable'.
    `java.lang.String` | `getBeanName()` | Returns name of bean.
    `BeanConfigBuilder` | `registeredBy​(BeanConfig parent)` |
    `BeanConfigBuilder` | `setActive​(boolean active)` |
    `BeanConfigBuilder` | `setPinned​(boolean pinned)` |
    `BeanConfigBuilder` | `setSource​(BeanConfig.Source source)` |
    `protected void` | `throwException​(KernelException e)` |
    `BeanConfigBuilder` | `withFactory​(java.lang.Class<? extends BeanFactory> beanFactoryClass)` | Defines factory for currently registered bean.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### log

          protected final java.util.logging.Logger log

  - ### Method Detail

    - #### asClass

          public BeanConfigBuilder asClass​(java.lang.Class<?> cls)

      Registers bean as type to be created when it will be required.
      Parameters:
        `cls` - class of bean.
      Returns:
        `BeanConfigBuilder`.

    - #### asInstance

          public BeanConfigBuilder asInstance​(java.lang.Object bean)

      Registers class instance as bean.
      Parameters:
        `bean` - instance of bean.
      Returns:
        `BeanConfigBuilder`.

    - #### exec

          public void exec()

      Finishing registration of bean.

    - #### execWithoutInject

          public BeanConfig execWithoutInject()

    - #### exportable

          public BeanConfigBuilder exportable()

      Mark bean as 'exportable'. It means that bean will be visible for all child Kernels registered in current Kernel.
      Returns:
        `BeanConfigBuilder`.

    - #### getBeanName

          public java.lang.String getBeanName()

      Returns name of bean.
      Returns:
        name of bean.

    - #### setActive

          public BeanConfigBuilder setActive​(boolean active)

    - #### setPinned

          public BeanConfigBuilder setPinned​(boolean pinned)

    - #### setSource

          public BeanConfigBuilder setSource​(BeanConfig.Source source)

    - #### registeredBy

          public BeanConfigBuilder registeredBy​(BeanConfig parent)

    - #### withFactory

          public BeanConfigBuilder withFactory​(java.lang.Class<? extends BeanFactory> beanFactoryClass)

      Defines factory for currently registered bean.
      Parameters:
        `beanFactoryClass` - bean factory class.
      Returns:
        `BeanConfigBuilder`.

    - #### throwException

          protected void throwException​(KernelException e)