Class MapConfigurationPropertySource
- java.lang.Object
- org.springframework.boot.context.properties.source.MapConfigurationPropertySource
- All Implemented Interfaces:
Iterable<ConfigurationPropertyName>
,ConfigurationPropertySource
,IterableConfigurationPropertySource
public class MapConfigurationPropertySource extends Object implements IterableConfigurationPropertySource
AnConfigurationPropertySource
backed by aMap
and using standard name mapping rules.
Constructor Summary
Constructors Constructor Description MapConfigurationPropertySource()
Create a new emptyMapConfigurationPropertySource
instance.MapConfigurationPropertySource(Map<?,?> map)
Create a newMapConfigurationPropertySource
instance with entries copies from the specified map.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationProperty
getConfigurationProperty(ConfigurationPropertyName name)
Return a singleConfigurationProperty
from the source ornull
if no property can be found.Object
getUnderlyingSource()
Return the underlying source that is actually providing the properties.Iterator<ConfigurationPropertyName>
iterator()
Return an iterator for thenames
managed by this source.void
put(Object name, Object value)
Add an individual entry.void
putAll(Map<?,?> map)
Add all entries from the specified map.Stream<ConfigurationPropertyName>
stream()
Returns a sequentialStream
for thenames
managed by this source.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.boot.context.properties.source.IterableConfigurationPropertySource
containsDescendantOf, filter, withAliases
Constructor Detail
MapConfigurationPropertySource
public MapConfigurationPropertySource()
Create a new emptyMapConfigurationPropertySource
instance.
MapConfigurationPropertySource
public MapConfigurationPropertySource(Map<?,?> map)
Create a newMapConfigurationPropertySource
instance with entries copies from the specified map.- Parameters:
map
- the source map
Method Detail
putAll
public void putAll(Map<?,?> map)
Add all entries from the specified map.- Parameters:
map
- the source map
put
public void put(Object name, Object value)
Add an individual entry.- Parameters:
name
- the namevalue
- the value
getUnderlyingSource
public Object getUnderlyingSource()
Description copied from interface:ConfigurationPropertySource
Return the underlying source that is actually providing the properties.- Specified by:
getUnderlyingSource
in interfaceConfigurationPropertySource
- Returns:
- the underlying property source or
null
.
getConfigurationProperty
public ConfigurationProperty getConfigurationProperty(ConfigurationPropertyName name)
Description copied from interface:ConfigurationPropertySource
Return a singleConfigurationProperty
from the source ornull
if no property can be found.- Specified by:
getConfigurationProperty
in interfaceConfigurationPropertySource
- Parameters:
name
- the name of the property (must not benull
)- Returns:
- the associated object or
null
.
iterator
public Iterator<ConfigurationPropertyName> iterator()
Description copied from interface:IterableConfigurationPropertySource
Return an iterator for thenames
managed by this source.- Specified by:
iterator
in interfaceIterable<ConfigurationPropertyName>
- Specified by:
iterator
in interfaceIterableConfigurationPropertySource
- Returns:
- an iterator (never
null
)
stream
public Stream<ConfigurationPropertyName> stream()
Description copied from interface:IterableConfigurationPropertySource
Returns a sequentialStream
for thenames
managed by this source.- Specified by:
stream
in interfaceIterableConfigurationPropertySource
- Returns:
- a stream of names (never
null
)