Class AbstractBeanConfigurator

All Implemented Interfaces:
Direct Known Subclasses:

public abstract class AbstractBeanConfigurator extends Object implements BeanConfigurator
  • Field Details

  • Constructor Details

    • AbstractBeanConfigurator

      public AbstractBeanConfigurator()
  • Method Details

    • getBeanClassesFromAnnotations

      public static Map<String,Class<?>> getBeanClassesFromAnnotations(Kernel kernel, Class<?> requiredClass)
      Method looks for bean classes (classes annotated with @Bean which has parent property set to passed class.
      kernel - instance of the Kernel
      requiredClass - class to look for as parent property value of @Bean annotation
      map of bean classes in for of "bean name" - "class"
    • isBeanClassRegisteredInParentKernel

      protected static boolean isBeanClassRegisteredInParentKernel(Kernel kernel, String name, Class<?> clazz)
      Method checkes if bean is already registered in parent kernel.
      kernel - kernel instance to check
      name - name of the bean
      clazz - expected class of the bean
    • mergeWithBeansPropertyValue

      protected static Map<String,AbstractBeanConfigurator.BeanDefinition> mergeWithBeansPropertyValue(Map<String,AbstractBeanConfigurator.BeanDefinition> beanPropConfigMap, Map<String,Object> values)
    • registerBeansForBeanOfClass

      public static void registerBeansForBeanOfClass(Kernel kernel, Class<?> cls)
      Method registers beans which classes are annotated with @Bean and have parent set to the class passed as parameter.
    • registerBeansForBeanOfClass

      protected static void registerBeansForBeanOfClass(Kernel kernel, Class<?> requiredClass, Set<Class<?>> classes)
    • registerBeansForBeanOfClassGetBeansToRegister

      protected static List<Class<?>> registerBeansForBeanOfClassGetBeansToRegister(Kernel kernel, Class<?> requiredClass, Set<Class<?>> classes)
    • registerBeansForBeanOfClassShouldRegister

      protected static Bean registerBeansForBeanOfClassShouldRegister(Kernel kernel, Class<?> requiredClass, Class<?> cls)
    • getProperties

      public abstract Map<String,Object> getProperties()
      Method returns current configuration map.
    • configure

      public void configure(BeanConfig beanConfig, Object bean, Map<String,Object> values)
      Method configures passed bean with provided values.
    • configure

      public void configure(BeanConfig beanConfig, Object bean) throws KernelException
      Description copied from interface: BeanConfigurator
      Configure bean.
      Specified by:
      configure in interface BeanConfigurator
      beanConfig - internal bean configuration.
      bean - bean to configure.
    • getDefaultTypesConverter

      public TypesConverter getDefaultTypesConverter()
      Method returns default types converter used by bean configurator.
    • setDefaultTypesConverter

      public void setDefaultTypesConverter(TypesConverter defaultTypesConverter)
    • getKernel

      public Kernel getKernel()
    • setKernel

      public void setKernel(Kernel kernel)
    • isAccessToAllFields

      public boolean isAccessToAllFields()
    • setAccessToAllFields

      public void setAccessToAllFields(boolean accessToAllFields)
    • registerBeans

      public void registerBeans(BeanConfig beanConfig, Object bean, Map<String,Object> values)
      Method registers all beans which are annotated by @Bean and which parent property is set to class which instance is passed. Additionally this method registers beans which definitions are passed in the configuration.
      Specified by:
      registerBeans in interface BeanConfigurator
      beanConfig - bean config of initializing bean
      bean - instance of initializing bean
      values - configuration of a bean
    • configurationChanged

      public void configurationChanged()
      Method applies configuration changes to bean. Should be called after configuration is updated.
      Specified by:
      configurationChanged in interface BeanConfigurator
    • restoreDefaults

      public void restoreDefaults(String beanName)
      Method restors default configuration of a bean
    • getConfiguration

      protected abstract Map<String,Object> getConfiguration(BeanConfig beanConfig)
      Method returns configuration of a bean.
    • grabDefaultConfig

      protected Map<Field,Object> grabDefaultConfig(BeanConfig beanConfig, Object bean)
    • grabCurrentConfig

      protected Map<Field,Object> grabCurrentConfig(Object bean, String beanName)
    • getBeanDefinitions

      protected Map<String,AbstractBeanConfigurator.BeanDefinition> getBeanDefinitions(Map<String,Object> values)
      Method returns map of bean definitions found in the configuration
      values - configuration map
    • getBeanConfigPath

      protected ArrayDeque<String> getBeanConfigPath(BeanConfig beanConfig)
      Method returns queue of kernel and bean names to find bean config (path to the bean config from root of the config).
    • hasDirectConfiguration

      protected abstract boolean hasDirectConfiguration(BeanConfig bc)
    • refreshConfiguration

      protected void refreshConfiguration(Kernel kernel)
    • refreshConfiguration_removeUndefinedBeans

      protected void refreshConfiguration_removeUndefinedBeans(Kernel kernel)
    • refreshConfiguration_updateConfiguration

      protected void refreshConfiguration_updateConfiguration(Kernel kernel)