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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getProperties, getProperties, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, nameOf
get, get, get
public 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)
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
return false for: resolver.containsProperty("foo")
To check for nested properties using PropertyResolver.containsProperties(String)
instead.
containsProperty
in interface PropertyResolver
name
- The name of the propertypublic boolean containsProperties(String name)
PropertyResolver
containsProperties
in interface PropertyResolver
name
- The name of the propertypublic <T> Optional<T> getProperty(String name, ArgumentConversionContext<T> conversionContext)
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.
getProperty
in interface PropertyResolver
T
- The concrete typename
- The nameconversionContext
- The conversion context