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 AnalyticsAwareFeatureFlagconvertToAnalyticsAware(FeatureFlag featureFlag) Creates a new FeatureFlag with the data from original feature key if FeatureFlag is not instance ofAnalyticsAwareFeatureFlagor returns flag itself otherwisestatic AnalyticsAwareFeatureFlagconvertToSafeFeatureFlag(FeatureFlag featureFlag) Creates a new FeatureFlag with the data from original feature key and set as safe for analyticsstatic FeatureFlagconvertToUnsafeFeatureFlag(FeatureFlag featureFlag) Creates a new FeatureFlag with the data from original feature key and set as unsafe for analyticsbooleanstatic AnalyticsAwareFeatureFlagfeatureFlag(String featureKey) Creates a new FeatureFlag with the specified key and off by default and set as unsafe for analyticsinthashCode()booleanstatic AnalyticsAwareFeatureFlagsafeFeatureFlag(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, isSysAdminOnly, offByDefault, onByDefault, sysAdminOnly, 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:
equalsin classFeatureFlag
-
hashCode
public int hashCode()- Overrides:
hashCodein 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 ofAnalyticsAwareFeatureFlagor returns flag itself otherwise- Parameters:
featureFlag- feature flag to convert- Returns:
- instance of
AnalyticsAwareFeatureFlagif the same settings as provided feature flag
-