Interface OptionalConfigurationProperty<T>

All Superinterfaces:
ConfigurationProperty<Optional<T>>

public interface OptionalConfigurationProperty<T> extends ConfigurationProperty<Optional<T>>
  • Method Details

    • 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, Supplier<RuntimeException> exceptionSupplier)
      Get the value of this configuration property, throwing an exception if the value is not present.
      Parameters:
      source - A configuration source.
      exceptionSupplier - A supplier that will be called to create an exception if the value is missing. 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, Supplier<RuntimeException> exceptionSupplier)
      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.
      exceptionSupplier - A supplier that will be called to create an exception if the value is missing.
      Returns:
      The value of this property according to the given source.