Interface ConfigurationPropertySource
- All Known Subinterfaces:
IterableConfigurationPropertySource
- All Known Implementing Classes:
MapConfigurationPropertySource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A source of
ConfigurationProperties.- Since:
- 2.0.0
- Author:
- Phillip Webb, Madhura Bhave
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault ConfigurationPropertyStateReturns if the source contains any descendants of the specified name.default ConfigurationPropertySourcefilter(Predicate<ConfigurationPropertyName> filter) Return a filtered variant of this source, containing only names that match the givenPredicate.static ConfigurationPropertySourcefrom(PropertySource<?> source) Return a single newConfigurationPropertySourceadapted from the given SpringPropertySourceornullif the source cannot be adapted.Return a singleConfigurationPropertyfrom the source ornullif no property can be found.default ObjectReturn the underlying source that is actually providing the properties.default ConfigurationPropertySourceReturn a variant of this source that supports name aliases.default ConfigurationPropertySourcewithPrefix(String prefix) Return a variant of this source that supports a prefix.
-
Method Details
-
getConfigurationProperty
Return a singleConfigurationPropertyfrom the source ornullif no property can be found.- Parameters:
name- the name of the property (must not benull)- Returns:
- the associated object or
null.
-
containsDescendantOf
Returns if the source contains any descendants of the specified name. May returnConfigurationPropertyState.PRESENTorConfigurationPropertyState.ABSENTif an answer can be determined orConfigurationPropertyState.UNKNOWNif it's not possible to determine a definitive answer.- Parameters:
name- the name to check- Returns:
- if the source contains any descendants
-
filter
Return a filtered variant of this source, containing only names that match the givenPredicate.- Parameters:
filter- the filter to match- Returns:
- a filtered
ConfigurationPropertySourceinstance
-
withAliases
Return a variant of this source that supports name aliases.- Parameters:
aliases- a function that returns a stream of aliases for any given name- Returns:
- a
ConfigurationPropertySourceinstance supporting name aliases
-
withPrefix
Return a variant of this source that supports a prefix.- Parameters:
prefix- the prefix for properties in the source- Returns:
- a
ConfigurationPropertySourceinstance supporting a prefix - Since:
- 2.5.0
-
getUnderlyingSource
Return the underlying source that is actually providing the properties.- Returns:
- the underlying property source or
null.
-
from
Return a single newConfigurationPropertySourceadapted from the given SpringPropertySourceornullif the source cannot be adapted.- Parameters:
source- the Spring property source to adapt- Returns:
- an adapted source or
nullSpringConfigurationPropertySource - Since:
- 2.4.0
-