Package jenkins.model.experimentalflags
Class UserExperimentalFlag<T>
- java.lang.Object
-
- jenkins.model.experimentalflags.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedUserExperimentalFlag(String flagKey)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ExtensionList<UserExperimentalFlag>all()protected abstract TdeserializeValue(Object serializedValue)Convert the serialized value into the usable instance.abstract TgetDefaultValue()abstract StringgetDisplayName()The name that will be used in the configuration page for that flag It must be user readableStringgetFlagConfigPage()StringgetFlagDescriptionPage()StringgetFlagKey()The ID used by the machine to link the flag with its value within the user propertiesTgetFlagValue()TgetFlagValue(User user)static <T> TgetFlagValueForCurrentUser(String flagClassCanonicalName)From the flag class, return the value of the flag for the current user If the returned value isnull, it means that either the class was not found or the current user is anonymousabstract StringgetShortDescription()Describe what the flag is changing depending on its value.abstract ObjectserializeValue(T rawValue)Convert the usable value into a serializable form that can be stored in the user property.
-
-
-
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 therawValueis 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), returningnullwill force to return thegetDefaultValue()
-
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()
-
getFlagDescriptionPage
public String getFlagDescriptionPage()
-
getFlagConfigPage
public String getFlagConfigPage()
-
all
@NonNull public static ExtensionList<UserExperimentalFlag> all()
-
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 isnull, it means that either the class was not found or the current user is anonymous
-
-