Interface FeatureToggleAgent


public interface FeatureToggleAgent
The FeatureToggleAgent provides access to feature-toggles set for a FirstSpirit server. The feature toggles may be set in the server's fs-server.conf file or via Java System properties for the server JVM.
Feature toggle names are always handled case insensitively, and internally they are always stored in an uppercase representation. Using only uppercase characters for a feature toggle name is recommended.
Since:
5.2.241102
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The common prefix for features toggle names used in System properties or fs-server.conf entries.
    The agent's technical type to be used to request the agent from a SpecialistsBroker.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isAvailable(@NotNull String featureToggleName)
    Test if a feature toggle is explicitly set by configuration, system property or internal FirstSpirit enum.
    boolean
    isEnabled(@NotNull String featureToggleName)
    Get the value for a given feature toggle name or return true if the toggle is not set or unknown as the default value.
    boolean
    isEnabled(@NotNull String featureToggleName, boolean defaultValue)
    Get the value for a given feature toggle name or return the default value if the toggle is not set or unknown.
  • Field Details

    • TYPE

      static final SpecialistType<FeatureToggleAgent> TYPE
      The agent's technical type to be used to request the agent from a SpecialistsBroker.
      Since:
      5.2.241102
    • FEATURE_TOGGLE_PROPERTY_PREFIX

      static final String FEATURE_TOGGLE_PROPERTY_PREFIX
      The common prefix for features toggle names used in System properties or fs-server.conf entries.
      Since:
      5.2.241102
      See Also:
  • Method Details

    • isAvailable

      boolean isAvailable(@NotNull @NotNull String featureToggleName)
      Test if a feature toggle is explicitly set by configuration, system property or internal FirstSpirit enum.
      Parameters:
      featureToggleName - The name of the feature toggle without any prefixes. Feature toggle names are always handled case insensitively, and internally they are always stored in an uppercase representation. Using only uppercase characters in a feature toggle name is recommended.
      Returns:
      true if the feature toggle is set by configuration, system property or internal FirstSpirit enum, false if the feature toggle is unknown.
      Since:
      5.2.241102
    • isEnabled

      boolean isEnabled(@NotNull @NotNull String featureToggleName)
      Get the value for a given feature toggle name or return true if the toggle is not set or unknown as the default value.
      Parameters:
      featureToggleName - The name of the feature toggle without any prefixes. Feature toggle names are always handled case insensitively, and internally they are always stored in an uppercase representation. Using only uppercase characters in a feature toggle name is recommended.
      Returns:
      true it the feature toggle is enabled or not set or unknown, false if it is disabled.
      Since:
      5.2.241102
    • isEnabled

      boolean isEnabled(@NotNull @NotNull String featureToggleName, boolean defaultValue)
      Get the value for a given feature toggle name or return the default value if the toggle is not set or unknown.
      Parameters:
      featureToggleName - The name of the feature toggle without any prefixes. Feature toggle names are always handled case insensitively, and internally they are always stored in an uppercase representation. Using only uppercase characters in a feature toggle name is recommended.
      defaultValue - Default value, used if the feature toggle is not set or unknown.
      Returns:
      true it the feature toggle is enabled, false if it is disabled, or the default value if the toggle is not set or unknown.
      Since:
      5.2.241102