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
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault ConfigurationPropertyState
Returns if the source contains any descendants of the specified name.default ConfigurationPropertySource
filter
(Predicate<ConfigurationPropertyName> filter) Return a filtered variant of this source, containing only names that match the givenPredicate
.static ConfigurationPropertySource
from
(org.springframework.core.env.PropertySource<?> source) Return a single newConfigurationPropertySource
adapted from the given SpringPropertySource
ornull
if the source cannot be adapted.Return a singleConfigurationProperty
from the source ornull
if no property can be found.default Object
Return the underlying source that is actually providing the properties.default ConfigurationPropertySource
Return a variant of this source that supports name aliases.default ConfigurationPropertySource
withPrefix
(String prefix) Return a variant of this source that supports a prefix.
-
Method Details
-
getConfigurationProperty
Return a singleConfigurationProperty
from the source ornull
if 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.PRESENT
orConfigurationPropertyState.ABSENT
if an answer can be determined orConfigurationPropertyState.UNKNOWN
if 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
ConfigurationPropertySource
instance
-
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
ConfigurationPropertySource
instance 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
ConfigurationPropertySource
instance 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 newConfigurationPropertySource
adapted from the given SpringPropertySource
ornull
if the source cannot be adapted.- Parameters:
source
- the Spring property source to adapt- Returns:
- an adapted source or
null
SpringConfigurationPropertySource
- Since:
- 2.4.0
-