Class UserExperimentalFlag<T>

  • All Implemented Interfaces:
    ExtensionPoint
    Direct Known Subclasses:
    BooleanUserExperimentalFlag

    public abstract class UserExperimentalFlag<T>
    extends Object
    implements ExtensionPoint
    User specific experimental flag to enable or disable specific behavior. As it's user specific, usually this kind of feature flag is only used for UI.
    Since:
    2.395
    • Constructor Detail

      • UserExperimentalFlag

        protected UserExperimentalFlag​(@NonNull
                                       String flagKey)
    • Method Detail

      • getDefaultValue

        @NonNull
        public abstract T getDefaultValue()
      • serializeValue

        @Nullable
        public abstract Object serializeValue​(T rawValue)
        Convert the usable value into a serializable form that can be stored in the user property. If no changes are necessary, simply returning the rawValue is fine.
      • deserializeValue

        @Nullable
        protected abstract T deserializeValue​(Object serializedValue)
        Convert the serialized value into the usable instance. If the instance is invalid (like after migration), returning null will force to return the getDefaultValue()
      • getDisplayName

        public abstract String getDisplayName()
        The name that will be used in the configuration page for that flag It must be user readable
      • getShortDescription

        @Nullable
        public abstract String getShortDescription()
        Describe what the flag is changing depending on its value. This method is called in description.jelly, which could be overloaded by children. It could return HTML content.
      • getFlagKey

        @NonNull
        public String getFlagKey()
        The ID used by the machine to link the flag with its value within the user properties
      • getFlagValue

        @NonNull
        public T getFlagValue()
      • getFlagValue

        @NonNull
        public T getFlagValue​(User user)
      • getFlagDescriptionPage

        public String getFlagDescriptionPage()
      • getFlagConfigPage

        public String getFlagConfigPage()
      • getFlagValueForCurrentUser

        @CheckForNull
        public static <T> T getFlagValueForCurrentUser​(String flagClassCanonicalName)
        From the flag class, return the value of the flag for the current user If the returned value is null, it means that either the class was not found or the current user is anonymous