public class MapPropertyResolver extends java.lang.Object implements PropertyResolver
PropertyResolver that resolves values from a backing map.| Constructor and Description |
|---|
MapPropertyResolver(java.util.Map<java.lang.String,java.lang.Object> map) |
MapPropertyResolver(java.util.Map<java.lang.String,java.lang.Object> map,
ConversionService conversionService) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsProperties(java.lang.String name)
Whether the given property or any nested properties exist for the key given key within this resolver.
|
boolean |
containsProperty(java.lang.String name)
Whether the given property is contained within this resolver.
|
<T> java.util.Optional<T> |
getProperty(java.lang.String name,
ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name, type and generic type arguments.
|
java.util.Collection<java.lang.String> |
getPropertyEntries(java.lang.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(java.util.Map<java.lang.String,java.lang.Object> map)
map - The map to resolves the properties frompublic MapPropertyResolver(java.util.Map<java.lang.String,java.lang.Object> map,
ConversionService conversionService)
map - The map to resolves the properties fromconversionService - The conversion servicepublic boolean containsProperty(java.lang.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(java.lang.String name)
PropertyResolvercontainsProperties in interface PropertyResolvername - The name of the propertypublic <T> java.util.Optional<T> getProperty(java.lang.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 java.util.Collection<java.lang.String> getPropertyEntries(@NonNull
java.lang.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