Package io.micronaut.core.value
Class MapPropertyResolver
java.lang.Object
io.micronaut.core.value.MapPropertyResolver
- All Implemented Interfaces:
PropertyResolver
,ValueResolver<String>
A
PropertyResolver
that resolves values from a backing map.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
ConstructorDescriptionMapPropertyResolver
(Map<String, Object> map) MapPropertyResolver
(Map<String, Object> map, ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsProperties
(String name) Whether the given property or any nested properties exist for the key given key within this resolver.boolean
containsProperty
(String name) Whether the given property is contained within this resolver.<T> Optional<T>
getProperty
(String name, ArgumentConversionContext<T> conversionContext) Resolve the given property for the given name, type and generic type arguments.getPropertyEntries
(@NonNull String name) Returns a collection of properties entries under the given key.getPropertyPathMatches
(String pathPattern) Will return for a given pattern such asfoo.*.bar.*
and array of arrays containing the variable names that match the pattern.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.value.PropertyResolver
get, getProperties, getProperties, getProperty, getProperty, getProperty, getProperty, getRequiredProperty
Methods inherited from interface io.micronaut.core.value.ValueResolver
get, get, get
-
Constructor Details
-
MapPropertyResolver
- Parameters:
map
- The map to resolves the properties from
-
MapPropertyResolver
- Parameters:
map
- The map to resolves the properties fromconversionService
- The conversion service
-
-
Method Details
-
containsProperty
Description copied from interface:PropertyResolver
Whether the given property is contained within this resolver.
Note that this method will return false for nested properties. In other words given a key of
foo.bar
this method will returnfalse
for:resolver.containsProperty("foo")
To check for nested properties using
PropertyResolver.containsProperties(String)
instead.- Specified by:
containsProperty
in interfacePropertyResolver
- Parameters:
name
- The name of the property- Returns:
- True if it is
-
containsProperties
Description copied from interface:PropertyResolver
Whether the given property or any nested properties exist for the key given key within this resolver.- Specified by:
containsProperties
in interfacePropertyResolver
- Parameters:
name
- The name of the property- Returns:
- True if it is
-
getProperty
Description copied from interface:PropertyResolver
Resolve the given property for the given name, type and generic type arguments.
Implementers can choose to implement more intelligent type conversion by analyzing the typeArgument.
- Specified by:
getProperty
in interfacePropertyResolver
- Type Parameters:
T
- The concrete type- Parameters:
name
- The nameconversionContext
- The conversion context- Returns:
- An optional containing the property value if it exists
-
getPropertyEntries
Description copied from interface:PropertyResolver
Returns a collection of properties entries under the given key. For example given the following keys:datasource.default.url=localhost datasource.another.url=someother
getPropertyEntries(String)
with a value ofdatasource
will result in a collection containingdefault
andother
.- Specified by:
getPropertyEntries
in interfacePropertyResolver
- Parameters:
name
- The name to resolve- Returns:
- The property entries.
-
getPropertyPathMatches
Description copied from interface:PropertyResolver
Will return for a given pattern such asfoo.*.bar.*
and array of arrays containing the variable names that match the pattern.- Specified by:
getPropertyPathMatches
in interfacePropertyResolver
- Parameters:
pathPattern
- The path pattern- Returns:
- An array of arrays.
-