Interface ConfigurationKey

All Known Implementing Classes:
io.inverno.mod.configuration.internal.GenericConfigurationKey, VersionedRedisConfigurationSource.VersionedRedisConfigurationKey

public interface ConfigurationKey

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:
  • Method Details

    • getName

      String getName()

      Returns the name of the configuration property.

      Returns:
      a name
    • 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

      boolean matches(ConfigurationKey other, boolean exact)

      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 that k2.matches(k1).

      Parameters:
      other - the other key to match
      exact - true for exact matching, false otherwise
      Returns:
      true if this key matches the other key, false otherwise
    • of

      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.

      Parameters:
      name - the configuration property name
      parameters - the configuration property parameters
      Returns:
      a configuration key
    • of

      static ConfigurationKey of(String name, String k1, Object v1)

      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 name
      k1 - the parameter name
      v1 - the parameter value
      Returns:
      a configuration key
    • of

      static ConfigurationKey of(String name, String k1, Object v1, String k2, Object v2)

      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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - the fourth parameter value
      k5 - the fifth parameter name
      v5 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - the fourth parameter value
      k5 - the fifth parameter name
      v5 - the fifth parameter value
      k6 - the sixth parameter name
      v6 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - the fourth parameter value
      k5 - the fifth parameter name
      v5 - the fifth parameter value
      k6 - the sixth parameter name
      v6 - the sixth parameter value
      k7 - the seventh parameter name
      v7 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - the fourth parameter value
      k5 - the fifth parameter name
      v5 - the fifth parameter value
      k6 - the sixth parameter name
      v6 - the sixth parameter value
      k7 - the seventh parameter name
      v7 - the seventh parameter value
      k8 - the eighth parameter name
      v8 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - the fourth parameter value
      k5 - the fifth parameter name
      v5 - the fifth parameter value
      k6 - the sixth parameter name
      v6 - the sixth parameter value
      k7 - the seventh parameter name
      v7 - the seventh parameter value
      k8 - the eighth parameter name
      v8 - the eighth parameter value
      k9 - the nineth parameter name
      v9 - 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 name
      k1 - the first parameter name
      v1 - the first parameter value
      k2 - the second parameter name
      v2 - the second parameter value
      k3 - the third parameter name
      v3 - the third parameter value
      k4 - the fourth parameter name
      v4 - the fourth parameter value
      k5 - the fifth parameter name
      v5 - the fifth parameter value
      k6 - the sixth parameter name
      v6 - the sixth parameter value
      k7 - the seventh parameter name
      v7 - the seventh parameter value
      k8 - the eighth parameter name
      v8 - the eighth parameter value
      k9 - the nineth parameter name
      v9 - the nineth parameter value
      k10 - the tenth parameter name
      v10 - the tenth parameter value
      Returns:
      a configuration key