Interface ConfigurationService

    • Method Detail

      • getSettings

        Map getSettings()
        Access to the complete map of config settings. The returned map is immutable
        Returns:
        The immutable map of config settings.
      • getSetting

        <T> T getSetting​(String name,
                         ConfigurationService.Converter<T> converter)
        Get the named setting, using the specified converter.
        Type Parameters:
        T - The Java type of the conversion
        Parameters:
        name - The name of the setting to get.
        converter - The converter to apply
        Returns:
        The converted (typed) setting. May return null (see getSetting(String, Class, Object))
      • getSetting

        <T> T getSetting​(String name,
                         ConfigurationService.Converter<T> converter,
                         T defaultValue)
        Get the named setting, using the specified converter and default value.
        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

        <T> T getSetting​(String name,
                         Class<T> expected,
                         T defaultValue)
        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.
        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

        @Deprecated
        <T> T cast​(Class<T> expected,
                   Object candidate)
        Deprecated.
        No idea why this is exposed here...
        Cast candidate to the instance of expected type.
        Type Parameters:
        T - The java type of the expected return
        Parameters:
        expected - The type of instance expected to return.
        candidate - The candidate object to be casted.
        Returns:
        The instance of expected type or null if this cast fail.