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.OrderedA 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 classPropertySource.PropertyConventionProperty convention.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTEXTThe 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.Objectget(java.lang.String key)Get a property value of the given key.default PropertySource.PropertyConventiongetConvention()java.lang.StringgetName()static java.util.Map<java.lang.String,java.lang.Object>mapOf(java.lang.Object... values)Create aLinkedHashMapof configuration from an array of values.static PropertySourceof(java.lang.String name, java.lang.Object... values)Create aPropertySourcefrom the given map.static PropertySourceof(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Create aPropertySourcefrom the given map.static PropertySourceof(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map, int priority)Create aPropertySourcefrom the given map.static PropertySourceof(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map, PropertySource.PropertyConvention convention)Create aPropertySourcefrom the given map.static PropertySourceof(java.util.Map<java.lang.String,java.lang.Object> map)Create aPropertySourcenamedEnvironment.DEFAULT_NAMEfrom 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 aPropertySourcefrom 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 aPropertySourcefrom 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 aPropertySourcefrom 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 aLinkedHashMapof 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 aPropertySourcefrom 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 aPropertySourcenamedEnvironment.DEFAULT_NAMEfrom the given map.- Parameters:
map- The map- Returns:
- The
PropertySource
-
-