Interface PropertyResolverDelegate
- All Superinterfaces:
PropertyResolver
,ValueResolver<String>
PropertyResolver
,
delegating all method calls to the underlying implementation. It combines functionality from the
PropertyResolver
and ValueResolver
interfaces.- Since:
- 5.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
containsProperties
(@NonNull String name) Whether the given property or any nested properties exist for the key given key within this resolver.default boolean
containsProperty
(@NonNull String name) Whether the given property is contained within this resolver.delegate()
Returns the delegatedPropertyResolver
instance.get
(@NonNull String name, @NonNull ArgumentConversionContext<T> conversionContext) Resolve the given property for the given name.Resolve the given property for the given name.Resolve the given property for the given name.default <T> T
Resolve the given property for the given name.getProperties
(@NonNull String name) Return all the properties under the given key.getProperties
(@Nullable String name, @Nullable StringConvention keyFormat) Return all the properties under the given key.getProperty
(@NonNull String name, @NonNull ArgumentConversionContext<T> conversionContext) Resolve the given property for the given name, type and generic type arguments.getProperty
(@NonNull String name, @NonNull Argument<T> argument) Resolve the given property for the given name, type and generic type arguments.getProperty
(@NonNull String name, @NonNull Class<T> requiredType) Resolve the given property for the given name.getProperty
(@NonNull String name, @NonNull Class<T> requiredType, @NonNull ConversionContext context) Resolve the given property for the given name, type and generic type arguments.default <T> T
getProperty
(@NonNull String name, @NonNull Class<T> requiredType, T defaultValue) Resolve the given property for the given name.default @NonNull Collection<String>
getPropertyEntries
(@NonNull String name) Returns a collection of properties entries under the given key.default @NonNull Collection<String>
getPropertyEntries
(@NonNull String name, @NonNull PropertyCatalog propertyCatalog) Returns a collection of properties entries under the given key, but .default @NonNull Collection<List<String>>
getPropertyPathMatches
(@NonNull String pathPattern) Will return for a given pattern such asfoo.*.bar.*
and array of arrays containing the variable names that match the pattern.default <T> T
getRequiredProperty
(@NonNull String name, @NonNull Class<T> requiredType) Resolve the given property for the given name.
-
Method Details
-
delegate
PropertyResolver delegate()Returns the delegatedPropertyResolver
instance.- Returns:
- the delegate
PropertyResolver
-
containsProperty
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 returnfalse
for:resolver.containsProperty("foo")
To check for nested properties using
PropertyResolver.containsProperties(String)
instead.- Specified by:
containsProperty
in interfacePropertyResolver
- Parameters:
name
- The name of the property- Returns:
- True if it is
-
containsProperties
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 interfacePropertyResolver
- Parameters:
name
- The name of the property- Returns:
- True if it is
-
getProperty
@NonNull default <T> @NonNull Optional<T> getProperty(@NonNull @NonNull String name, @NonNull @NonNull 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 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: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
getPropertyEntries(String)
with a value ofdatasource
will result in a collection containingdefault
andother
.- Specified by:
getPropertyEntries
in interfacePropertyResolver
- Parameters:
name
- The name to resolve- Returns:
- The property entries.
-
getPropertyEntries
@NonNull default @NonNull Collection<String> getPropertyEntries(@NonNull @NonNull String name, @NonNull @NonNull PropertyCatalog propertyCatalog) Description copied from interface:PropertyResolver
Returns a collection of properties entries under the given key, but . For example, if you setPropertyCatalog.RAW
then the following keys:datasource.MyDs-1.url=localhost datasource.MyDs-2.url=someother
getPropertyEntries(String)
with a value ofdatasource
will result in a collection containingMyDs-1
andMyDs-2
(without normalization).- Specified by:
getPropertyEntries
in interfacePropertyResolver
- Parameters:
name
- The name to resolvepropertyCatalog
- property catalog to use- Returns:
- The property entries.
-
getProperty
@NonNull default <T> @NonNull Optional<T> getProperty(@NonNull @NonNull String name, @NonNull @NonNull Argument<T> argument) 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 interfacePropertyResolver
- Type Parameters:
T
- The concrete type- Parameters:
name
- The nameargument
- The required type- Returns:
- An optional containing the property value if it exists
-
getProperties
Description copied from interface:PropertyResolver
Return all the properties under the given key.- Specified by:
getProperties
in interfacePropertyResolver
- Parameters:
name
- The name- Returns:
- The properties
-
getProperties
@NonNull default @NonNull Map<String,Object> getProperties(@Nullable @Nullable String name, @Nullable @Nullable StringConvention keyFormat) Description copied from interface:PropertyResolver
Return all the properties under the given key. By default, Micronaut stores keys in keb-case, such that normalized lookups are more efficient. You can obtain the raw key values by passing inStringConvention.RAW
.- Specified by:
getProperties
in interfacePropertyResolver
- Parameters:
name
- The namekeyFormat
- The key format to use for the keys. Default is kebab-case.- Returns:
- The properties
-
getProperty
@NonNull default <T> @NonNull Optional<T> getProperty(@NonNull @NonNull String name, @NonNull @NonNull Class<T> requiredType, @NonNull @NonNull ConversionContext context) 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 interfacePropertyResolver
- Type Parameters:
T
- The concrete type- Parameters:
name
- The namerequiredType
- The required typecontext
- TheConversionContext
to apply to any conversion- Returns:
- An optional containing the property value if it exists
-
get
@NonNull default <T> @NonNull Optional<T> get(@NonNull @NonNull String name, @NonNull @NonNull ArgumentConversionContext<T> conversionContext) Description copied from interface:ValueResolver
Resolve the given property for the given name.- Specified by:
get
in interfacePropertyResolver
- Specified by:
get
in interfaceValueResolver<String>
- Type Parameters:
T
- The concrete type- Parameters:
name
- The nameconversionContext
- The conversion context- Returns:
- An optional containing the property value if it exists and is able to be converted
-
getProperty
@NonNull default <T> @NonNull Optional<T> getProperty(@NonNull @NonNull String name, @NonNull @NonNull Class<T> requiredType) Description copied from interface:PropertyResolver
Resolve the given property for the given name.- Specified by:
getProperty
in interfacePropertyResolver
- Type Parameters:
T
- The concrete type- Parameters:
name
- The namerequiredType
- The required type- Returns:
- An optional containing the property value if it exists
-
getProperty
@Nullable default <T> T getProperty(@NonNull @NonNull String name, @NonNull @NonNull Class<T> requiredType, @Nullable T defaultValue) Description copied from interface:PropertyResolver
Resolve the given property for the given name.- Specified by:
getProperty
in interfacePropertyResolver
- Type Parameters:
T
- The concrete type- Parameters:
name
- The namerequiredType
- The required typedefaultValue
- The default value- Returns:
- An optional containing the property value if it exists
-
getRequiredProperty
@NonNull default <T> T getRequiredProperty(@NonNull @NonNull String name, @NonNull @NonNull Class<T> requiredType) Description copied from interface:PropertyResolver
Resolve the given property for the given name.- Specified by:
getRequiredProperty
in interfacePropertyResolver
- Type Parameters:
T
- The concrete type- Parameters:
name
- The name of the propertyrequiredType
- The required type- Returns:
- The value of the property
-
getPropertyPathMatches
@NonNull default @NonNull Collection<List<String>> getPropertyPathMatches(@NonNull @NonNull String pathPattern) Description copied from interface:PropertyResolver
Will return for a given pattern such asfoo.*.bar.*
and array of arrays containing the variable names that match the pattern.- Specified by:
getPropertyPathMatches
in interfacePropertyResolver
- Parameters:
pathPattern
- The path pattern- Returns:
- An array of arrays.
-
get
@NonNull default <T> @NonNull Optional<T> get(@NonNull @NonNull String name, @NonNull @NonNull Class<T> requiredType) Description copied from interface:ValueResolver
Resolve the given property for the given name.- Specified by:
get
in interfaceValueResolver<String>
- Type Parameters:
T
- The concrete type- Parameters:
name
- The namerequiredType
- The required type- Returns:
- An optional containing the property value if it exists and is able to be converted
-
get
@NonNull default <T> @NonNull Optional<T> get(@NonNull @NonNull String name, @NonNull @NonNull Argument<T> requiredType) Description copied from interface:ValueResolver
Resolve the given property for the given name.- Specified by:
get
in interfaceValueResolver<String>
- Type Parameters:
T
- The concrete type- Parameters:
name
- The namerequiredType
- The required type- Returns:
- An optional containing the property value if it exists and is able to be converted
-
get
default <T> T get(@NonNull @NonNull String name, @NonNull @NonNull Class<T> requiredType, T defaultValue) Description copied from interface:ValueResolver
Resolve the given property for the given name.- Specified by:
get
in interfaceValueResolver<String>
- Type Parameters:
T
- The concrete type- Parameters:
name
- The namerequiredType
- The required typedefaultValue
- The default value- Returns:
- Property value if it exists or default value
-