public class MapPropertySource extends java.lang.Object implements PropertySource
PropertySource
that uses a map.PropertySource.PropertyConvention
CONTEXT
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
MapPropertySource(java.lang.String name,
java.util.Map map)
Creates a map property source.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
asMap()
The backing map (unmodifiable).
|
java.lang.Object |
get(java.lang.String key)
Get a property value of the given key.
|
java.lang.String |
getName() |
java.util.Iterator<java.lang.String> |
iterator() |
static MapPropertySource |
of(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> map)
Create a new
MapPropertySource from the given map. |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConvention, mapOf, of, of, of, of
public MapPropertySource(java.lang.String name, java.util.Map map)
name
- The name of the property sourcemap
- The mappublic java.lang.String getName()
getName
in interface PropertySource
public java.lang.Object get(java.lang.String key)
PropertySource
get
in interface PropertySource
key
- The keypublic java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
public java.util.Map<java.lang.String,java.lang.Object> asMap()
public static MapPropertySource of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)
MapPropertySource
from the given map.of
in interface PropertySource
name
- The name of the property sourcemap
- The mappublic java.lang.String toString()
toString
in class java.lang.Object