public interface PropertyResolver extends ValueResolver<java.lang.String>
| 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.
|
default <T> java.util.Optional<T> |
get(java.lang.String name,
ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name.
|
default java.util.Map<java.lang.String,java.lang.Object> |
getProperties(java.lang.String name)
Return all the properties under the given key.
|
default java.util.Map<java.lang.String,java.lang.Object> |
getProperties(java.lang.String name,
StringConvention keyFormat)
Return all the properties under the given key.
|
default <T> java.util.Optional<T> |
getProperty(java.lang.String name,
Argument<T> argument)
Resolve the given property for the given name, type and generic type arguments.
|
<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.
|
default <T> java.util.Optional<T> |
getProperty(java.lang.String name,
java.lang.Class<T> requiredType)
Resolve the given property for the given name.
|
default <T> java.util.Optional<T> |
getProperty(java.lang.String name,
java.lang.Class<T> requiredType,
ConversionContext context)
Resolve the given property for the given name, type and generic type arguments.
|
default <T> T |
getProperty(java.lang.String name,
java.lang.Class<T> requiredType,
T defaultValue)
Resolve the given property for the given name.
|
default java.util.Collection<java.lang.String> |
getPropertyEntries(java.lang.String name)
Returns a collection of properties entries under the given key.
|
default <T> T |
getRequiredProperty(java.lang.String name,
java.lang.Class<T> requiredType)
Resolve the given property for the given name.
|
static java.lang.String |
nameOf(java.lang.String... path)
Builds a property name for the given property path.
|
get, get, getboolean containsProperty(@NonNull
java.lang.String name)
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 containsProperties(String) instead.
name - The name of the propertyboolean containsProperties(@NonNull
java.lang.String name)
name - The name of the property@NonNull
<T> java.util.Optional<T> getProperty(@NonNull
java.lang.String name,
@NonNull
ArgumentConversionContext<T> conversionContext)
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.
T - The concrete typename - The nameconversionContext - The conversion context@NonNull
default java.util.Collection<java.lang.String> getPropertyEntries(@NonNull
java.lang.String name)
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.name - The name to resolve@NonNull
default <T> java.util.Optional<T> getProperty(@NonNull
java.lang.String name,
@NonNull
Argument<T> argument)
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.
T - The concrete typename - The nameargument - The required type@NonNull
default java.util.Map<java.lang.String,java.lang.Object> getProperties(@NonNull
java.lang.String name)
name - The name@NonNull
default java.util.Map<java.lang.String,java.lang.Object> getProperties(@Nullable
java.lang.String name,
@Nullable
StringConvention keyFormat)
StringConvention.RAW.name - The namekeyFormat - The key format to use for the keys. Default is kebab-case.@NonNull
default <T> java.util.Optional<T> getProperty(@NonNull
java.lang.String name,
@NonNull
java.lang.Class<T> requiredType,
@NonNull
ConversionContext context)
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.
T - The concrete typename - The namerequiredType - The required typecontext - The ConversionContext to apply to any conversion@NonNull
default <T> java.util.Optional<T> get(@NonNull
java.lang.String name,
@NonNull
ArgumentConversionContext<T> conversionContext)
ValueResolverget in interface ValueResolver<java.lang.String>T - The concrete typename - The nameconversionContext - The conversion context@NonNull
default <T> java.util.Optional<T> getProperty(@NonNull
java.lang.String name,
@NonNull
java.lang.Class<T> requiredType)
T - The concrete typename - The namerequiredType - The required type@Nullable
default <T> T getProperty(@NonNull
java.lang.String name,
@NonNull
java.lang.Class<T> requiredType,
@Nullable
T defaultValue)
T - The concrete typename - The namerequiredType - The required typedefaultValue - The default value@NonNull
default <T> T getRequiredProperty(@NonNull
java.lang.String name,
@NonNull
java.lang.Class<T> requiredType)
throws PropertyNotFoundException
T - The concrete typename - The name of the propertyrequiredType - The required typePropertyNotFoundException - exception when property does not existstatic java.lang.String nameOf(java.lang.String... path)
path - The path