Package com.vaadin.experimental
Class FeatureFlags
- java.lang.Object
-
- com.vaadin.experimental.FeatureFlags
-
- All Implemented Interfaces:
Serializable
public class FeatureFlags extends Object implements Serializable
Tracks available feature flags and their status. Enabled feature flags are stored invaadin-featureflags.propertiesinside the resources folder (src/main/resources).- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFeatureFlags.FeatureFlagsWrapperFeatureFlags wrapper class for storing the FeatureFlags object.
-
Field Summary
Fields Modifier and Type Field Description static FeatureCOLLABORATION_ENGINE_BACKENDstatic FeatureENFORCE_FIELD_VALIDATIONstatic FeatureEXAMPLEstatic FeatureHILLA_ENGINEstatic FeatureHILLA_PUSHstatic FeatureOLD_LICENSE_CHECKERstatic StringPROPERTIES_FILENAMEstatic StringSYSTEM_PROPERTY_PREFIXstatic FeatureWEBPACK
-
Constructor Summary
Constructors Constructor Description FeatureFlags(Lookup lookup)Generate FeatureFlags with given lookup data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FeatureFlagsget(VaadinContext context)Gets the FeatureFlags for the given Vaadin context.StringgetEnableHelperMessage(Feature feature)List<Feature>getFeatures()Get a list of all available features and their status.booleanisEnabled(Feature feature)Checks if the given feature is enabled.booleanisEnabled(String featureId)Checks if the given feature is enabled.voidloadProperties()Read the feature flag properties files and updates the enable property of each feature object.voidsetEnabled(String featureId, boolean enabled)Enables or disables the given feature.voidsetPropertiesLocation(File propertiesFolder)Set by the Maven / Gradle plugin when running through that so the feature flags will be correctly detected.
-
-
-
Field Detail
-
PROPERTIES_FILENAME
public static final String PROPERTIES_FILENAME
- See Also:
- Constant Field Values
-
SYSTEM_PROPERTY_PREFIX
public static final String SYSTEM_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
EXAMPLE
public static final Feature EXAMPLE
-
WEBPACK
public static final Feature WEBPACK
-
HILLA_PUSH
public static final Feature HILLA_PUSH
-
HILLA_ENGINE
public static final Feature HILLA_ENGINE
-
OLD_LICENSE_CHECKER
public static final Feature OLD_LICENSE_CHECKER
-
COLLABORATION_ENGINE_BACKEND
public static final Feature COLLABORATION_ENGINE_BACKEND
-
ENFORCE_FIELD_VALIDATION
public static final Feature ENFORCE_FIELD_VALIDATION
-
-
Constructor Detail
-
FeatureFlags
public FeatureFlags(Lookup lookup)
Generate FeatureFlags with given lookup data.- Parameters:
lookup- lookup to use
-
-
Method Detail
-
get
public static FeatureFlags get(VaadinContext context)
Gets the FeatureFlags for the given Vaadin context. If the Vaadin context has no FeatureFlags, a new instance is created and assigned to the context.- Parameters:
context- the vaadin context for which to get FeatureFlags from, notnull- Returns:
- a feature flags instance for the given context, not
null
-
setPropertiesLocation
public void setPropertiesLocation(File propertiesFolder)
Set by the Maven / Gradle plugin when running through that so the feature flags will be correctly detected.
-
loadProperties
public void loadProperties()
Read the feature flag properties files and updates the enable property of each feature object.
-
getFeatures
public List<Feature> getFeatures()
Get a list of all available features and their status.- Returns:
- a list of all features
-
isEnabled
public boolean isEnabled(Feature feature)
Checks if the given feature is enabled.- Parameters:
feature- the feature to check- Returns:
trueif enabled,falseotherwise
-
isEnabled
public boolean isEnabled(String featureId)
Checks if the given feature is enabled.- Parameters:
featureId- the feature to check- Returns:
trueif enabled,falseotherwise
-
setEnabled
public void setEnabled(String featureId, boolean enabled)
Enables or disables the given feature.- Parameters:
featureId- the feature idenabled-trueto enable,falseto disable
-
-