Package com.atlassian.jira.config
Class AnalyticsAwareFeatureFlag
java.lang.Object
com.atlassian.jira.config.FeatureFlag
com.atlassian.jira.config.AnalyticsAwareFeatureFlag
- All Implemented Interfaces:
Feature
A AnalyticsAwareFeatureFlag is extended version of
FeatureFlag
that makes Feature Flag
analytics compatible. It means that with safeFeatureKey property it is possible to declare that feature key
should be hashed or can be passed as it is. Default behaviour is to hash all feature keys.
If you don't know what analytics are or if you are not sure if your feature key is safe, then you don't want to use this class.
This class is useful only when used together with FeatureFlagProvider
. If you use this class outside of implementation
of FeatureFlagProvider
it will have no effect = class will be working as normal implementation of FeatureFlag
.
-
Field Summary
Fields inherited from class com.atlassian.jira.config.FeatureFlag
POSTFIX_DISABLED, POSTFIX_ENABLED
-
Method Summary
Modifier and TypeMethodDescriptionstatic AnalyticsAwareFeatureFlag
convertToAnalyticsAware
(FeatureFlag featureFlag) Creates a new FeatureFlag with the data from original feature key if FeatureFlag is not instance ofAnalyticsAwareFeatureFlag
or returns flag itself otherwisestatic AnalyticsAwareFeatureFlag
convertToSafeFeatureFlag
(FeatureFlag featureFlag) Creates a new FeatureFlag with the data from original feature key and set as safe for analyticsstatic FeatureFlag
convertToUnsafeFeatureFlag
(FeatureFlag featureFlag) Creates a new FeatureFlag with the data from original feature key and set as unsafe for analyticsboolean
static AnalyticsAwareFeatureFlag
featureFlag
(String featureKey) Creates a new FeatureFlag with the specified key and off by default and set as unsafe for analyticsint
hashCode()
boolean
static AnalyticsAwareFeatureFlag
safeFeatureFlag
(String featureKey) Creates a new FeatureFlag with the specified key and off by default and set as safe for analyticssafeKey()
Creates a new FeatureFlag that is set as safe for analyticsCreates a new FeatureFlag that is set as unsafe for analyticsMethods inherited from class com.atlassian.jira.config.FeatureFlag
defaultedTo, disabledFeatureKey, enabledFeatureKey, featureKey, isOnByDefault, offByDefault, onByDefault, toString
-
Method Details
-
isSafeFlagForAnalytics
public boolean isSafeFlagForAnalytics()- Returns:
- true if feature flag key doesn't contain UGC and false otherwise
-
getSafeFeatureKey
- Returns:
- feature key if flag is analytics friendly of SHA256 of feature key if flag is not analytics friendly
-
safeKey
Creates a new FeatureFlag that is set as safe for analytics- Returns:
- a new feature flag
-
unsafeKey
Creates a new FeatureFlag that is set as unsafe for analytics- Returns:
- a new feature flag
-
equals
- Overrides:
equals
in classFeatureFlag
-
hashCode
public int hashCode()- Overrides:
hashCode
in classFeatureFlag
-
featureFlag
Creates a new FeatureFlag with the specified key and off by default and set as unsafe for analytics- Parameters:
featureKey
- the key in play- Returns:
- a new feature flag
-
safeFeatureFlag
Creates a new FeatureFlag with the specified key and off by default and set as safe for analytics- Parameters:
featureKey
- the key in play- Returns:
- a new feature flag
-
convertToSafeFeatureFlag
Creates a new FeatureFlag with the data from original feature key and set as safe for analytics- Parameters:
featureFlag
- the flag in play- Returns:
- a new feature flag
-
convertToUnsafeFeatureFlag
Creates a new FeatureFlag with the data from original feature key and set as unsafe for analytics- Parameters:
featureFlag
- the flag in play- Returns:
- a new feature flag
-
convertToAnalyticsAware
Creates a new FeatureFlag with the data from original feature key if FeatureFlag is not instance ofAnalyticsAwareFeatureFlag
or returns flag itself otherwise- Parameters:
featureFlag
- feature flag to convert- Returns:
- instance of
AnalyticsAwareFeatureFlag
if the same settings as provided feature flag
-