public class MapPropertyResolver extends Object implements PropertyResolver
PropertyResolver that resolves values from a backing map.| Constructor and Description |
|---|
MapPropertyResolver(Map<String,Object> map) |
MapPropertyResolver(Map<String,Object> map,
ConversionService conversionService) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
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.
|
Collection<String> |
getPropertyEntries(String name)
Returns a collection of properties entries under the given key.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitget, getProperties, getProperties, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, nameOfget, get, getpublic MapPropertyResolver(Map<String,Object> map)
map - The map to resolves the properties frompublic MapPropertyResolver(Map<String,Object> map, ConversionService conversionService)
map - The map to resolves the properties fromconversionService - The conversion servicepublic boolean containsProperty(String name)
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.bar this method will
return false for: resolver.containsProperty("foo")
To check for nested properties using PropertyResolver.containsProperties(String) instead.
containsProperty in interface PropertyResolvername - The name of the propertypublic boolean containsProperties(String name)
PropertyResolvercontainsProperties in interface PropertyResolvername - The name of the propertypublic <T> Optional<T> getProperty(String name, ArgumentConversionContext<T> conversionContext)
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.
getProperty in interface PropertyResolverT - The concrete typename - The nameconversionContext - The conversion context@NonNull public Collection<String> getPropertyEntries(@NonNull String name)
PropertyResolver
datasource.default.url=localhost
datasource.another.url=someother
Calling getPropertyEntries(String) with a value of datasource will result in a collection
containing default and other.getPropertyEntries in interface PropertyResolvername - The name to resolve