Class SettingsKey

java.lang.Object
com.atlassian.bitbucket.settingsrestriction.SettingsKey

public class SettingsKey extends Object
The identifier in a ProjectSettingsRestriction for the settings of a given feature.

A SettingsKey provides a unique identifier for an individual feature using a ProjectSettingsRestriction. Each SettingsKey is composed of a getNamespace() which represents plugin provider, and a getFeatureKey() which represents the feature being restricted. A settings key can also have an optional getComponentKey(), which represents an individual component of a feature that can restricted.

Note that it is possible for consumers to provide settings keys that have the same feature key and namespace, but with both null and non-null component keys. This is a permitted operation, but we provide no particular handling for it, and the meaning of these restrictions is left to the consumer to determine.

The getFeatureKey(), getNamespace() and getComponentKey() are all defined by the feature provider, though in general each provider should use the same namespace for all features they offer restrictions for, a unique feature key for every feature and use component keys only when each component of a feature should share the same post processor.

Since:
8.10
See Also:
  • Field Details

    • MIN_COMPONENT_KEY_LENGTH

      public static final int MIN_COMPONENT_KEY_LENGTH
      See Also:
    • MAX_FEATURE_KEY_LENGTH

      public static final int MAX_FEATURE_KEY_LENGTH
      See Also:
    • MAX_NAMESPACE_LENGTH

      public static final int MAX_NAMESPACE_LENGTH
      See Also:
    • MAX_COMPONENT_KEY_LENGTH

      public static final int MAX_COMPONENT_KEY_LENGTH
      See Also:
  • Method Details

    • getComponentKey

      @Nonnull public Optional<String> getComponentKey()
      The component key part of the settings key.

      The component key should be used when multiple components of a single feature can individually be restricted or unrestricted. Settings that have the same namespace and feature key but differing component keys will share the same post-processing.

      The component key must be between MIN_COMPONENT_KEY_LENGTH and MAX_COMPONENT_KEY_LENGTH characters in length.

      Returns:
      an optional containing the component key used to identify individual components within the getFeatureKey()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getFeatureKey

      @Nonnull public String getFeatureKey()
      The feature key part of the settings key.

      The feature key can not be blank or longer than MAX_FEATURE_KEY_LENGTH characters.

      Returns:
      a key used to uniquely identify an individual feature within the getNamespace()
    • getNamespace

      @Nonnull public String getNamespace()
      The namespace part of the settings key.

      The namespace can not be blank or longer than MAX_NAMESPACE_LENGTH characters. Plugin developers are recommended to use a namespace tied to the plugin. A good example would be using reverse domain names used by java packages.

      Returns:
      a namespace used to identify the provider of the feature
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object