public interface PropertyResolver extends ValueResolver<String>
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.
|
default <T> Optional<T> |
get(String name,
ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name.
|
default Map<String,Object> |
getProperties(String name)
Return all the properties under the given key.
|
default Map<String,Object> |
getProperties(String name,
StringConvention keyFormat)
Return all the properties under the given key.
|
default <T> Optional<T> |
getProperty(String name,
Argument<T> argument)
Resolve the given property for the given name, type and generic type arguments.
|
<T> Optional<T> |
getProperty(String name,
ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name, type and generic type arguments.
|
default <T> Optional<T> |
getProperty(String name,
Class<T> requiredType)
Resolve the given property for the given name.
|
default <T> Optional<T> |
getProperty(String name,
Class<T> requiredType,
ConversionContext context)
Resolve the given property for the given name, type and generic type arguments.
|
default <T> T |
getProperty(String name,
Class<T> requiredType,
T defaultValue)
Resolve the given property for the given name.
|
default <T> T |
getRequiredProperty(String name,
Class<T> requiredType)
Resolve the given property for the given name.
|
static String |
nameOf(String... path)
Builds a property name for the given property path.
|
get, get, get
boolean containsProperty(@Nonnull 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 String name)
name
- The name of the property@Nonnull <T> Optional<T> getProperty(@Nonnull 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 <T> Optional<T> getProperty(@Nonnull 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 Map<String,Object> getProperties(@Nonnull String name)
name
- The name@Nonnull default Map<String,Object> getProperties(@Nullable String name, @Nullable StringConvention keyFormat)
name
- The namekeyFormat
- The key format to use for the keys. Default is kebab-case.@Nonnull default <T> Optional<T> getProperty(@Nonnull String name, @Nonnull 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> Optional<T> get(@Nonnull String name, @Nonnull ArgumentConversionContext<T> conversionContext)
ValueResolver
get
in interface ValueResolver<String>
T
- The concrete typename
- The nameconversionContext
- The conversion context@Nonnull default <T> Optional<T> getProperty(@Nonnull String name, @Nonnull Class<T> requiredType)
T
- The concrete typename
- The namerequiredType
- The required type@Nullable default <T> T getProperty(@Nonnull String name, @Nonnull Class<T> requiredType, @Nullable T defaultValue)
T
- The concrete typename
- The namerequiredType
- The required typedefaultValue
- The default value@Nonnull default <T> T getRequiredProperty(@Nonnull String name, @Nonnull Class<T> requiredType) throws PropertyNotFoundException
T
- The concrete typename
- The name of the propertyrequiredType
- The required typePropertyNotFoundException
- exception when property does not exist