Interface BeanConfigManager<B extends BeanConfig>

Type Parameters:
B - the bean configuration implementation class

public interface BeanConfigManager<B extends BeanConfig>
A strongly typed bean configuration manager using the strongly typed implementation of a BeanConfig. It rides on top of the weakly typed bean configuration properties manager (see BeanConfigPropertiesManager). Underneath this wrapper, the bean name ( BeanConfig.getBeanClassName()) and the configuration properties ( BeanConfig.getProperties()) are extracted and passed to the bean properties manager.
Since:
8.0
Author:
Moran Avigdor, Itai Frenkel
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends B>
    void
    disableBean(Class<T> clazz)
    Disables a bean.
    <T extends B>
    void
    enableBean(Class<T> clazz)
    Enable a previously set bean configuration.
    <T extends B>
    T
    getBeanConfig(Class<T> clazz)
    Get the bean configuration represented by the specified configuration class.
    <T extends B>
    boolean
    isBeanEnabled(Class<T> clazz)
     
    <T extends B>
    boolean
    Removes a bean configuration.
    void
    setBeanConfig(B config)
    Defines a configuration for the specified bean.
  • Method Details

    • setBeanConfig

      void setBeanConfig(B config) throws EnabledBeanConfigCannotBeChangedException
      Defines a configuration for the specified bean. Overrides all previously set properties for that bean. The configuration object internally holds String key-value pairs used to configure this bean.

      An exception is raised if the bean is enabled.

      Parameters:
      config - the bean configuration
      Throws:
      EnabledBeanConfigCannotBeChangedException - The bean is enabled. Disable it first.
    • enableBean

      Enable a previously set bean configuration. Creates the bean instance with the previously set bean configuration.

      If the bean is already enabled, the request is silently ignored.

      Type Parameters:
      T - a bean configuration implementation (see BeanConfig)
      Parameters:
      clazz - the class of the bean configuration
      Throws:
      BeanConfigNotFoundException - bean configuration cannot be found.
      BeanConfigurationException - in the event of misconfiguration (such as failure to set an essential property).
      BeanInitializationException - if bean initialization fails.
    • disableBean

      <T extends B> void disableBean(Class<T> clazz) throws BeanConfigNotFoundException
      Disables a bean. The bean object is discarded but it's configuration remains. The bean can be enabled at a later time.

      If the bean is already disabled, the request is silently ignored.

      Type Parameters:
      T - a bean configuration implementation (see BeanConfig)
      Parameters:
      clazz - the class of the bean configuration
      Throws:
      BeanConfigNotFoundException - bean configuration cannot be found.
    • isBeanEnabled

      <T extends B> boolean isBeanEnabled(Class<T> clazz)
      Type Parameters:
      T - a bean configuration implementation (see BeanConfig)
      Parameters:
      clazz - the class of the bean configuration
      Returns:
      true if the bean is enabled, false if the bean is disabled.
    • removeBeanConfig

      <T extends B> boolean removeBeanConfig(Class<T> clazz) throws EnabledBeanConfigCannotBeChangedException, BeanConfigNotFoundException
      Removes a bean configuration.

      An exception is raised if the bean is enabled.

      Type Parameters:
      T - a bean configuration implementation (see BeanConfig)
      Parameters:
      clazz - the class of the bean configuration
      Returns:
      true if removed ,false if it did not exist in the first place.
      Throws:
      EnabledBeanConfigCannotBeChangedException - The bean is enabled. Disable it first.
      BeanConfigNotFoundException - bean configuration cannot be found.
    • getBeanConfig

      <T extends B> T getBeanConfig(Class<T> clazz) throws BeanConfigNotFoundException
      Get the bean configuration represented by the specified configuration class.
      Type Parameters:
      T - a bean configuration implementation (see BeanConfig)
      Parameters:
      clazz - the class of the bean configuration
      Returns:
      The bean configuration implementation object set with the configuration properties.
      Throws:
      BeanConfigNotFoundException - bean configuration cannot be found. Need to set the configuration first.