Package org.springframework.core.env
Class MapPropertySource
- java.lang.Object
- org.springframework.core.env.PropertySource<T>
- org.springframework.core.env.EnumerablePropertySource<Map<String,Object>>
- org.springframework.core.env.MapPropertySource
- Direct Known Subclasses:
PropertiesPropertySource,SystemEnvironmentPropertySource
public class MapPropertySource extends EnumerablePropertySource<Map<String,Object>>
PropertySourcethat reads keys and values from aMapobject.- Since:
- 3.1
- Author:
- Chris Beams, Juergen Hoeller
- See Also:
PropertiesPropertySource
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.core.env.PropertySource
PropertySource.StubPropertySource
Field Summary
Fields inherited from class org.springframework.core.env.PropertySource
logger, name, source
Constructor Summary
Constructors Constructor Description MapPropertySource(String name, Map<String,Object> source)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsProperty(String name)Return whether thisPropertySourcecontains a property with the given name.ObjectgetProperty(String name)Return the value associated with the given name, ornullif not found.String[]getPropertyNames()Return the names of all properties contained by the source object (nevernull).
Constructor Detail
MapPropertySource
public MapPropertySource(String name, Map<String,Object> source)
Method Detail
getProperty
public Object getProperty(String name)
Description copied from class:PropertySourceReturn the value associated with the given name, ornullif not found.- Specified by:
getPropertyin classPropertySource<Map<String,Object>>- Parameters:
name- the property to find- See Also:
PropertyResolver.getRequiredProperty(String)
containsProperty
public boolean containsProperty(String name)
Description copied from class:EnumerablePropertySourceReturn whether thisPropertySourcecontains a property with the given name.This implementation checks for the presence of the given name within the
EnumerablePropertySource.getPropertyNames()array.- Overrides:
containsPropertyin classEnumerablePropertySource<Map<String,Object>>- Parameters:
name- the name of the property to find
getPropertyNames
public String[] getPropertyNames()
Description copied from class:EnumerablePropertySourceReturn the names of all properties contained by the source object (nevernull).- Specified by:
getPropertyNamesin classEnumerablePropertySource<Map<String,Object>>