- All Known Implementing Classes:
io.inverno.mod.configuration.internal.GenericConfigurationKey
,VersionedRedisConfigurationSource.VersionedRedisConfigurationKey
A configuration key uniquely identifies a configuration property in a configuration source. It is composed of a name and a collection of parameters.
The use of parameters in the key makes it possible to define different values for the same configuration property name and retrieve them within a particular context. For instance, it is possible to define a value in a test environment and different value for the same property in a production environment.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
A parameter is used to specify the context in which a property value is defined.static class
An undefined parameter is used to match properties that do not defined a particular parameter in a list configuration query.static class
A wildcard parameter is used to match all values for a parameter in a list configuration query. -
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns the name of the configuration property.getParameter
(String key) Returns the parameter with the specified key.Returns the list of parameters specifying the context in which a property value is defined.boolean
matches
(ConfigurationKey other, boolean exact) Determines whether this configuration key matches the other key.static ConfigurationKey
of
(String name, ConfigurationKey.Parameter... parameters) Creates a configuration key with the specified name and list of parameters specifying the context in which a property value is defined.static ConfigurationKey
Creates a configuration key with the specified name and parameter specifying the context in which a property value is defined.static ConfigurationKey
Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7, String k8, Object v8) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7, String k8, Object v8, String k9, Object v9) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.static ConfigurationKey
of
(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7, String k8, Object v8, String k9, Object v9, String k10, Object v10) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
-
Method Details
-
getName
String getName()Returns the name of the configuration property.
- Returns:
- a name
-
getParameters
Collection<ConfigurationKey.Parameter> getParameters()Returns the list of parameters specifying the context in which a property value is defined.
- Returns:
- a collection of parameters or an empty collection if the key does not define any parameter
-
getParameter
Returns the parameter with the specified key.
- Parameters:
key
- the parameter key- Returns:
- an optional returning the parameter or an empty optional if there's no parameter with the specified key
-
matches
Determines whether this configuration key matches the other key.
When the match is exact, this method returns true only if the this key defines the exact same parameters as the other key with matching values.
When the match is not exact, it returns true when the key defines the same parameters as the other key with matching values, it can define other parameters.
This method is not necessarily symmetric:
k1.matches(k2)
does not imply thatk2.matches(k1)
.- Parameters:
other
- the other key to matchexact
- true for exact matching, false otherwise- Returns:
- true if this key matches the other key, false otherwise
-
of
Creates a configuration key with the specified name and list of parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property nameparameters
- the configuration property parameters- Returns:
- a configuration key
-
of
Creates a configuration key with the specified name and parameter specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the parameter namev1
- the parameter value- Returns:
- a configuration key
-
of
Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter valuek5
- the fifth parameter namev5
- the fifth parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter valuek5
- the fifth parameter namev5
- the fifth parameter valuek6
- the sixth parameter namev6
- the sixth parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter valuek5
- the fifth parameter namev5
- the fifth parameter valuek6
- the sixth parameter namev6
- the sixth parameter valuek7
- the seventh parameter namev7
- the seventh parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7, String k8, Object v8) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter valuek5
- the fifth parameter namev5
- the fifth parameter valuek6
- the sixth parameter namev6
- the sixth parameter valuek7
- the seventh parameter namev7
- the seventh parameter valuek8
- the eighth parameter namev8
- the eighth parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7, String k8, Object v8, String k9, Object v9) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter valuek5
- the fifth parameter namev5
- the fifth parameter valuek6
- the sixth parameter namev6
- the sixth parameter valuek7
- the seventh parameter namev7
- the seventh parameter valuek8
- the eighth parameter namev8
- the eighth parameter valuek9
- the nineth parameter namev9
- the nineth parameter value- Returns:
- a configuration key
-
of
static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2, String k3, Object v3, String k4, Object v4, String k5, Object v5, String k6, Object v6, String k7, Object v7, String k8, Object v8, String k9, Object v9, String k10, Object v10) Creates a configuration key with the specified name and parameters specifying the context in which a property value is defined.
- Parameters:
name
- the configuration property namek1
- the first parameter namev1
- the first parameter valuek2
- the second parameter namev2
- the second parameter valuek3
- the third parameter namev3
- the third parameter valuek4
- the fourth parameter namev4
- the fourth parameter valuek5
- the fifth parameter namev5
- the fifth parameter valuek6
- the sixth parameter namev6
- the sixth parameter valuek7
- the seventh parameter namev7
- the seventh parameter valuek8
- the eighth parameter namev8
- the eighth parameter valuek9
- the nineth parameter namev9
- the nineth parameter valuek10
- the tenth parameter namev10
- the tenth parameter value- Returns:
- a configuration key
-