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
ConstructorsConstructorDescriptionMapPropertyResolver(Map<String, Object> map) MapPropertyResolver(Map<String, Object> map, ConversionService conversionService) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsProperties(String name) Whether the given property or any nested properties exist for the key given key within this resolver.booleancontainsProperty(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, waitMethods inherited from interface io.micronaut.core.value.PropertyResolver
get, getProperties, getProperties, getProperty, getProperty, getProperty, getProperty, getPropertyEntries, getRequiredPropertyMethods 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:PropertyResolverWhether 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.barthis method will returnfalsefor:resolver.containsProperty("foo")To check for nested properties using
PropertyResolver.containsProperties(String)instead.- Specified by:
containsPropertyin interfacePropertyResolver- Parameters:
name- The name of the property- Returns:
- True if it is
-
containsProperties
Description copied from interface:PropertyResolverWhether the given property or any nested properties exist for the key given key within this resolver.- Specified by:
containsPropertiesin interfacePropertyResolver- Parameters:
name- The name of the property- Returns:
- True if it is
-
getProperty
Description copied from interface:PropertyResolverResolve 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:
getPropertyin 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:PropertyResolverReturns a collection of properties entries under the given key. For example given the following keys:
Callingdatasource.default.url=localhost datasource.another.url=someothergetPropertyEntries(String)with a value ofdatasourcewill result in a collection containingdefaultandother.- Specified by:
getPropertyEntriesin interfacePropertyResolver- Parameters:
name- The name to resolve- Returns:
- The property entries.
-
getPropertyPathMatches
Description copied from interface:PropertyResolverWill return for a given pattern such asfoo.*.bar.*and array of arrays containing the variable names that match the pattern.- Specified by:
getPropertyPathMatchesin interfacePropertyResolver- Parameters:
pathPattern- The path pattern- Returns:
- An array of arrays.
-