Class DefaultConfigurationBuilder.FileConfigurationProvider

    • Constructor Detail

      • FileConfigurationProvider

        public FileConfigurationProvider()
        Creates a new instance of FileConfigurationProvider.
      • FileConfigurationProvider

        public FileConfigurationProvider​(java.lang.Class<?> configClass)
        Creates a new instance of FileConfigurationProvider and sets the configuration class.
        Parameters:
        configClass - the class for the configurations to be created
      • FileConfigurationProvider

        public FileConfigurationProvider​(java.lang.String configClassName)
        Creates a new instance of FileConfigurationProvider and sets the configuration class name.
        Parameters:
        configClassName - the name of the configuration to be created
        Since:
        1.4
    • Method Detail

      • getEmptyConfiguration

        public AbstractConfiguration getEmptyConfiguration​(DefaultConfigurationBuilder.ConfigurationDeclaration decl)
                                                    throws java.lang.Exception
        Returns an uninitialized file configuration. This method will be called for optional configurations when the getConfiguration() method caused an error and the forceCreate attribute is set. It will create the configuration of the represented type, but the load() method won't be called. This way non-existing configuration files can be handled gracefully: If loading a the file fails, an empty configuration will be created that is already configured with the correct file name.
        Overrides:
        getEmptyConfiguration in class DefaultConfigurationBuilder.ConfigurationProvider
        Parameters:
        decl - the bean declaration with initialization parameters for the configuration
        Returns:
        the new configuration object
        Throws:
        java.lang.Exception - if an error occurs
        Since:
        1.4
      • initBeanInstance

        protected void initBeanInstance​(java.lang.Object bean,
                                        BeanDeclaration data)
                                 throws java.lang.Exception
        Initializes the bean instance. Ensures that the file configuration's base path will be initialized with the base path of the factory so that relative path names can be correctly resolved.
        Overrides:
        initBeanInstance in class DefaultBeanFactory
        Parameters:
        bean - the bean to be initialized
        data - the declaration
        Throws:
        java.lang.Exception - if an error occurs