Class MapPropertyResolver

    • Constructor Detail

      • MapPropertyResolver

        public MapPropertyResolver​(java.util.Map<java.lang.String,​java.lang.Object> map)
        Parameters:
        map - The map to resolves the properties from
      • MapPropertyResolver

        public MapPropertyResolver​(java.util.Map<java.lang.String,​java.lang.Object> map,
                                   ConversionService conversionService)
        Parameters:
        map - The map to resolves the properties from
        conversionService - The conversion service
    • Method Detail

      • containsProperty

        public boolean containsProperty​(java.lang.String name)
        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 return false for: resolver.containsProperty("foo")

        To check for nested properties using PropertyResolver.containsProperties(String) instead.

        Specified by:
        containsProperty in interface PropertyResolver
        Parameters:
        name - The name of the property
        Returns:
        True if it is
      • containsProperties

        public boolean containsProperties​(java.lang.String name)
        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 interface PropertyResolver
        Parameters:
        name - The name of the property
        Returns:
        True if it is
      • getProperty

        public <T> java.util.Optional<T> getProperty​(java.lang.String name,
                                                     ArgumentConversionContext<T> conversionContext)
        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 interface PropertyResolver
        Type Parameters:
        T - The concrete type
        Parameters:
        name - The name
        conversionContext - The conversion context
        Returns:
        An optional containing the property value if it exists
      • getPropertyEntries

        @NonNull
        public java.util.Collection<java.lang.String> getPropertyEntries​(@NonNull
                                                                         java.lang.String name)
        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
         
        Calling getPropertyEntries(String) with a value of datasource will result in a collection containing default and other.
        Specified by:
        getPropertyEntries in interface PropertyResolver
        Parameters:
        name - The name to resolve
        Returns:
        The property entries.