Interface OptionalConfigurationProperty<T>

    • Method Detail

      • getAndMap

        <R> Optional<R> getAndMap​(ConfigurationPropertySource source,
                                  Function<T,​R> transform)
        Get and transform the value of this configuration property.

        Similar to calling ConfigurationProperty.getAndTransform(ConfigurationPropertySource, Function), but easier to use, since the transform function is applied to the content of the optional, not to the optional itself.

        Any exception occurring during transformation will be wrapped in another exception adding some context, such as the resolved key for this property.

        Type Parameters:
        R - The transformed type.
        Parameters:
        source - A configuration source.
        transform - A transform function to be applied to the value of this configuration property before returning the result.
        Returns:
        The value of this property according to the given source.
      • getOrThrow

        T getOrThrow​(ConfigurationPropertySource source,
                     Function<String,​RuntimeException> exceptionFunction)
        Get the value of this configuration property, throwing an exception if the value is not present.
        Parameters:
        source - A configuration source.
        exceptionFunction - A function that will be called with the property key as a parameter to create an exception if the value is missing.
        Returns:
        The value of this property according to the given source.
      • getAndMapOrThrow

        <R> R getAndMapOrThrow​(ConfigurationPropertySource source,
                               Function<T,​R> transform,
                               Function<String,​RuntimeException> exceptionFunction)
        Get and transform the value of this configuration property, throwing an exception if the value is not present.

        Any exception occurring during transformation will be wrapped in another exception adding some context, such as the resolved key for this property.

        Type Parameters:
        R - The transformed type.
        Parameters:
        source - A configuration source.
        transform - A transform function to be applied to the value of this configuration property before returning the result.
        exceptionFunction - A function that will be called with the property key as a parameter to create an exception if the value is missing.
        Returns:
        The value of this property according to the given source.