Class ConfigurationServiceImpl

    • Constructor Detail

      • ConfigurationServiceImpl

        public ConfigurationServiceImpl​(Map<String,​Object> settings)
        Constructs a ConfigurationServiceImpl
        Parameters:
        settings - The map of settings
    • Method Detail

      • getSetting

        public <T> @PolyNull T getSetting​(String name,
                                          ConfigurationService.Converter<T> converter,
                                          @PolyNull T defaultValue)
        Description copied from interface: ConfigurationService
        Get the named setting, using the specified converter and default value.
        Specified by:
        getSetting in interface ConfigurationService
        Type Parameters:
        T - The Java type of the conversion
        Parameters:
        name - The name of the setting to get.
        converter - The converter to apply
        defaultValue - If no setting with that name is found, return this default value as the result.
        Returns:
        The converted (typed) setting. Will be the defaultValue if no such setting was defined.
      • getSetting

        public <T> @PolyNull T getSetting​(String name,
                                          Class<T> expected,
                                          @PolyNull T defaultValue)
        Description copied from interface: ConfigurationService
        Get the named setting. Differs from the form taking a Converter in that here we expect to have a simple cast rather than any involved conversion.
        Specified by:
        getSetting in interface ConfigurationService
        Type Parameters:
        T - The Java type of the conversion
        Parameters:
        name - The name of the setting to get.
        expected - The expected Java type.
        defaultValue - If no setting with that name is found, return this default value as the result.
        Returns:
        The converted (typed) setting. Will be the defaultValue if no such setting was defined.
      • cast

        public <T> @Nullable T cast​(Class<T> expected,
                                    @Nullable Object candidate)