public interface OptionalConfigurationProperty<T> extends ConfigurationProperty<Optional<T>>
Modifier and Type | Method and Description |
---|---|
<R> Optional<R> |
getAndMap(ConfigurationPropertySource source,
Function<T,R> transform)
Get and transform the value of this configuration property.
|
<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.
|
T |
getOrThrow(ConfigurationPropertySource source,
Function<String,RuntimeException> exceptionFunction)
Get the value of this configuration property, throwing an exception if the value is not present.
|
forKey, get, getAndTransform, resolve, resolveOrRaw
<R> Optional<R> getAndMap(ConfigurationPropertySource source, Function<T,R> transform)
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.
source
- A configuration source.transform
- A transform function to be applied to the value of this configuration property
before returning the result.T getOrThrow(ConfigurationPropertySource source, Function<String,RuntimeException> exceptionFunction)
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.<R> R getAndMapOrThrow(ConfigurationPropertySource source, Function<T,R> transform, Function<String,RuntimeException> exceptionFunction)
Any exception occurring during transformation will be wrapped in another exception adding some context,
such as the resolved key
for this property.
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.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.