Class AbstractBeanConfigurator

    • Constructor Detail

      • AbstractBeanConfigurator

        public AbstractBeanConfigurator()
    • Method Detail

      • getBeanClassesFromAnnotations

        public static java.util.Map<java.lang.String,​java.lang.Class<?>> getBeanClassesFromAnnotations​(Kernel kernel,
                                                                                                             java.lang.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,
                                                                     java.lang.String name,
                                                                     java.lang.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
      • registerBeansForBeanOfClass

        public static void registerBeansForBeanOfClass​(Kernel kernel,
                                                       java.lang.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,
                                                          java.lang.Class<?> requiredClass,
                                                          java.util.Set<java.lang.Class<?>> classes)
      • registerBeansForBeanOfClassGetBeansToRegister

        protected static java.util.List<java.lang.Class<?>> registerBeansForBeanOfClassGetBeansToRegister​(Kernel kernel,
                                                                                                          java.lang.Class<?> requiredClass,
                                                                                                          java.util.Set<java.lang.Class<?>> classes)
      • registerBeansForBeanOfClassShouldRegister

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

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

        public void configure​(BeanConfig beanConfig,
                              java.lang.Object bean,
                              java.util.Map<java.lang.String,​java.lang.Object> values)
        Method configures passed bean with provided values.
      • 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,
                                  java.lang.Object bean,
                                  java.util.Map<java.lang.String,​java.lang.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​(java.lang.String beanName)
        Method restors default configuration of a bean
      • getConfiguration

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

        protected java.util.Map<java.lang.reflect.Field,​java.lang.Object> grabDefaultConfig​(BeanConfig beanConfig,
                                                                                                  java.lang.Object bean)
      • grabCurrentConfig

        protected java.util.Map<java.lang.reflect.Field,​java.lang.Object> grabCurrentConfig​(java.lang.Object bean,
                                                                                                  java.lang.String beanName)
      • getBeanDefinitions

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

        protected java.util.ArrayDeque<java.lang.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)