public class MapPropertySource extends EnumerablePropertySource<Map<String,Object>>
PropertySource that reads keys and values from a Map object.
The underlying map should not contain any null values in order to
comply with getProperty(java.lang.String) and containsProperty(java.lang.String) semantics.PropertiesPropertySourcePropertySource.StubPropertySourcelogger, name, source| Constructor and Description |
|---|
MapPropertySource(String name,
Map<String,Object> source)
Create a new
MapPropertySource with the given name and Map. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsProperty(String name)
Return whether this
PropertySource contains a property with the given name. |
Object |
getProperty(String name)
Return the value associated with the given name,
or
null if not found. |
String[] |
getPropertyNames()
Return the names of all properties contained by the
source object (never
null). |
public MapPropertySource(String name, Map<String,Object> source)
MapPropertySource with the given name and Map.name - the associated namesource - the Map source (without null values in order to get
consistent getProperty(java.lang.String) and containsProperty(java.lang.String) behavior)@Nullable public Object getProperty(String name)
PropertySourcenull if not found.getProperty in class PropertySource<Map<String,Object>>name - the property to findPropertyResolver.getRequiredProperty(String)public boolean containsProperty(String name)
EnumerablePropertySourcePropertySource contains a property with the given name.
This implementation checks for the presence of the given name within the
EnumerablePropertySource.getPropertyNames() array.
containsProperty in class EnumerablePropertySource<Map<String,Object>>name - the name of the property to findpublic String[] getPropertyNames()
EnumerablePropertySourcenull).getPropertyNames in class EnumerablePropertySource<Map<String,Object>>