Package io.micronaut.context.env
Interface PropertySource
-
- All Superinterfaces:
java.lang.Iterable<java.lang.String>
,io.micronaut.core.order.Ordered
- All Known Implementing Classes:
CommandLinePropertySource
,EmptyPropertySource
,EnvironmentPropertySource
,KubernetesEnvironmentPropertySource
,MapPropertySource
,SystemPropertiesPropertySource
public interface PropertySource extends java.lang.Iterable<java.lang.String>, io.micronaut.core.order.Ordered
A PropertySource is a location to resolve property values from. The property keys are available via theIterable.iterator()
method.- Since:
- 1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
PropertySource.PropertyConvention
Property convention.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTEXT
The name of the property source with values supplied directly from the context.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.Object
get(java.lang.String key)
Get a property value of the given key.default PropertySource.PropertyConvention
getConvention()
java.lang.String
getName()
static java.util.Map<java.lang.String,java.lang.Object>
mapOf(java.lang.Object... values)
Create aLinkedHashMap
of configuration from an array of values.static PropertySource
of(java.lang.String name, java.lang.Object... values)
Create aPropertySource
from the given map.static PropertySource
of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)
Create aPropertySource
from the given map.static PropertySource
of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map, int priority)
Create aPropertySource
from the given map.static PropertySource
of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map, PropertySource.PropertyConvention convention)
Create aPropertySource
from the given map.static PropertySource
of(java.util.Map<java.lang.String,java.lang.Object> map)
Create aPropertySource
namedEnvironment.DEFAULT_NAME
from the given map.
-
-
-
Field Detail
-
CONTEXT
static final java.lang.String CONTEXT
The name of the property source with values supplied directly from the context.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
- Returns:
- The name of the property source
-
get
java.lang.Object get(java.lang.String key)
Get a property value of the given key.- Parameters:
key
- The key- Returns:
- The value
-
getConvention
default PropertySource.PropertyConvention getConvention()
- Returns:
- Whether the property source has upper case under score separated keys
-
of
static PropertySource of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)
Create aPropertySource
from the given map.- Parameters:
name
- The name of the property sourcemap
- The map- Returns:
- The
PropertySource
-
of
static PropertySource of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map, PropertySource.PropertyConvention convention)
Create aPropertySource
from the given map.- Parameters:
name
- The name of the property sourcemap
- The mapconvention
- The convention type of the property source- Returns:
- The
PropertySource
-
of
static PropertySource of(java.lang.String name, java.lang.Object... values)
Create aPropertySource
from the given map.- Parameters:
name
- The name of the property sourcevalues
- The values as an array of alternating key/value entries- Returns:
- The
PropertySource
- Since:
- 2.0
-
mapOf
static java.util.Map<java.lang.String,java.lang.Object> mapOf(java.lang.Object... values)
Create aLinkedHashMap
of configuration from an array of values.- Parameters:
values
- The values- Returns:
- The created map
- Since:
- 2.0
-
of
static PropertySource of(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map, int priority)
Create aPropertySource
from the given map.- Parameters:
name
- The name of the property sourcemap
- The mappriority
- The priority to order by- Returns:
- The
PropertySource
-
of
static PropertySource of(java.util.Map<java.lang.String,java.lang.Object> map)
Create aPropertySource
namedEnvironment.DEFAULT_NAME
from the given map.- Parameters:
map
- The map- Returns:
- The
PropertySource
-
-