public class EnvironmentMapAdapter
extends java.util.AbstractMap<java.lang.String,java.lang.String>
Map
implementation adapting an Environment
object in order to use the Environment
as a Map
.Map
,
AbstractMap
,
Environment
,
PropertySource
,
Adapter Software Design PatternModifier and Type | Class and Description |
---|---|
protected static class |
EnvironmentMapAdapter.EnvironmentEntry
EnvironmentMapAdapter.EnvironmentEntry is a Map.Entry implementation mapping an Environment property (key)
to its value. |
Constructor and Description |
---|
EnvironmentMapAdapter(org.springframework.core.env.Environment environment)
Constructs a new instance of
EnvironmentMapAdapter initialized with the given Environment . |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Object key)
Null-safe method determining whether the given
key is a property
in the underlying Environment . |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> |
entrySet() |
static EnvironmentMapAdapter |
from(org.springframework.core.env.Environment environment)
Factory method used to construct an new instance of
EnvironmentMapAdapter initialized with
the given Environment . |
java.lang.String |
get(java.lang.Object key)
Gets the
value for the property identified by the given Map key
from the underlying Environment . |
protected org.springframework.core.env.Environment |
getEnvironment()
Gets the configured
Environment object being adapted by this Map . |
clear, clone, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
public EnvironmentMapAdapter(@NonNull org.springframework.core.env.Environment environment)
EnvironmentMapAdapter
initialized with the given Environment
.environment
- Environment
to adapt; must not be null.java.lang.IllegalArgumentException
- if Environment
is null.Environment
public static EnvironmentMapAdapter from(@NonNull org.springframework.core.env.Environment environment)
EnvironmentMapAdapter
initialized with
the given Environment
.environment
- Environment
to adapt; must not be null.EnvironmentMapAdapter
for the given Environment
.java.lang.IllegalArgumentException
- if Environment
is null.Environment
,
EnvironmentMapAdapter(Environment)
@NonNull protected org.springframework.core.env.Environment getEnvironment()
Environment
object being adapted by this Map
.Environment
; never null.Environment
public boolean containsKey(@Nullable java.lang.Object key)
key
is a property
in the underlying Environment
.containsKey
in interface java.util.Map<java.lang.String,java.lang.String>
containsKey
in class java.util.AbstractMap<java.lang.String,java.lang.String>
key
is a property
in the underlying Environment
.PropertyResolver.containsProperty(String)
,
getEnvironment()
@Nullable public java.lang.String get(@Nullable java.lang.Object key)
value
for the property identified by the given Map
key
from the underlying Environment
.get
in interface java.util.Map<java.lang.String,java.lang.String>
get
in class java.util.AbstractMap<java.lang.String,java.lang.String>
key
- key
identifying the property whose value will be retrieved from the Environment
.value
of the property identified by the given Map
key
from the Environment
.PropertyResolver.getProperty(String)
,
getEnvironment()
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.String>
entrySet
in class java.util.AbstractMap<java.lang.String,java.lang.String>