tigase.kernel.beans

## Annotation Type Bean

-     @Target(value=TYPE)
       @Retention(value=RUNTIME)
       @Inherited
       @Documented
      public @interface Bean

  Defines name of bean.

  This annotation is not required, but each bean must be named! Instead of using annotation, name of bean may be defined during registration.

- - ### Required Element Summary

    Required Elements
    Modifier and Type | Required Element and Description
    --- | ---
    `boolean` | `active` Is active by default. * `true` if annotated bean (if registered) should be active (automatically loaded if required); `false` if annotated bean will not be automatically loaded, even if it will be registered.
    `String` | `name` Name of bean. * This name will be used to find bean and load configuration for the bean.

  - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `boolean` | `exportable` Is bean exportable?
    `Class` | `parent` Class of a parent bean. * Returns parent class for which this bean should always be registered. * Following cases are supported: `Object` if bean should never be automatically registered `Kernel` if bean should be automatically registered in the main/root kernel class implementing `RegistrarBean` if bean should be loaded automatically for that class
    `Class[]` | `parents` Classes of parent beans. * In some cases same beans should be automatically registered for more than one class.
    `Class<? extends BeanSelector>[]` | `selectors` Automatic registration selectors. * In some cases it is required/useful to decide if beans should be registered automatically depending on more global configuration option.

- - ### Element Detail

    - #### name

          public abstract String name

      Name of bean. *
      This name will be used to find bean and load configuration for the bean.
      Returns:
        name of bean.

  - - #### active

          public abstract boolean active

      Is active by default. *
      - `true` if annotated bean (if registered) should be active (automatically loaded if required);
      - `false` if annotated bean will not be automatically loaded, even if it will be registered. It will require manual activation in the configuration.
      Returns:
        `true` if bean should be automatically loaded

  - - #### exportable

          public abstract boolean exportable

      Is bean exportable? *
      Exportable beans are available not only in the context of a kernel in which they are registered but are available also to all beans registered in subkernels.
      Returns:
        `true` if bean should be available also in subkernels
      Default:
        false

  - - #### parent

          public abstract Class parent

      Class of a parent bean. *
      Returns parent class for which this bean should always be registered. *
      Following cases are supported:
      - `Object` if bean should never be automatically registered
      - `Kernel` if bean should be automatically registered in the main/root kernel
      - class implementing `RegistrarBean` if bean should be loaded automatically for that class
      Returns:
        parent class for which this class should be automatically registered
      Default:
        java.lang.Object.class

  - - #### parents

          public abstract Class[] parents

      Classes of parent beans. *
      In some cases same beans should be automatically registered for more than one class. This method allows to return more than one class.
      Returns:
        array of classes for which this class should be automatically registered
      See Also:
        `parent()`
      Default:
        {}

  - - #### selectors

          public abstract Class<? extends BeanSelector>[] selectors

      Automatic registration selectors. *
      In some cases it is required/useful to decide if beans should be registered automatically depending on more global configuration option. This method returns array of `BeanSelector` classes which provide a logic deciding if bean should be automatically loaded or not. *
      Will only work if `parent()` or `parents()` returns correct values.
      Returns:
        array of classes deciding if bean should be automatically loaded.
      Default:
        {}

Copyright © 2004–2021 "Tigase, Inc.". All rights reserved.