Package io.micronaut.context.env
Class MapPropertySource
- java.lang.Object
-
- io.micronaut.context.env.MapPropertySource
-
- All Implemented Interfaces:
PropertySource
,io.micronaut.core.order.Ordered
,java.lang.Iterable<java.lang.String>
- Direct Known Subclasses:
CommandLinePropertySource
,EnvironmentPropertySource
,KubernetesEnvironmentPropertySource
,SystemPropertiesPropertySource
public class MapPropertySource extends java.lang.Object implements PropertySource
APropertySource
that uses a map.- Since:
- 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.micronaut.context.env.PropertySource
PropertySource.PropertyConvention
-
-
Field Summary
-
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Fields inherited from interface io.micronaut.context.env.PropertySource
CONTEXT
-
-
Constructor Summary
Constructors Constructor Description MapPropertySource(java.lang.String name, java.util.Map map)
Creates a map property source.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 newMapPropertySource
from the given map.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.micronaut.context.env.PropertySource
getConvention
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfacePropertySource
- Returns:
- The name of the property source
-
get
public java.lang.Object get(java.lang.String key)
Description copied from interface:PropertySource
Get a property value of the given key.- Specified by:
get
in interfacePropertySource
- Parameters:
key
- The key- Returns:
- The value
-
iterator
public java.util.Iterator<java.lang.String> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.String>
-
asMap
public java.util.Map<java.lang.String,java.lang.Object> asMap()
The backing map (unmodifiable).- Returns:
- The backing map
-
of
public static MapPropertySource of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)
Create a newMapPropertySource
from the given map.- Parameters:
name
- The name of the property sourcemap
- The map- Returns:
- The map property source
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-