Package com.configcat

Interface ConfigurationProvider

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    ConfigCatClient

    public interface ConfigurationProvider
    extends java.io.Closeable
    Defines the public interface of the ConfigCatClient.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearDefaultUser()
      Set default user value to null.
      RefreshResult forceRefresh()
      Initiates a force refresh synchronously on the cached configuration.
      java.util.concurrent.CompletableFuture<RefreshResult> forceRefreshAsync()
      Initiates a force refresh asynchronously on the cached configuration.
      java.util.Collection<java.lang.String> getAllKeys()
      Gets a collection of all setting keys.
      java.util.concurrent.CompletableFuture<java.util.Collection<java.lang.String>> getAllKeysAsync()
      Gets a collection of all setting keys asynchronously.
      java.util.List<EvaluationDetails<java.lang.Object>> getAllValueDetails()
      Gets the detailed values of all feature flags or settings synchronously.
      java.util.List<EvaluationDetails<java.lang.Object>> getAllValueDetails​(User user)
      Gets the detailed values of all feature flags or settings synchronously.
      java.util.concurrent.CompletableFuture<java.util.List<EvaluationDetails<java.lang.Object>>> getAllValueDetailsAsync()
      Gets the detailed values of all feature flags or settings asynchronously.
      java.util.concurrent.CompletableFuture<java.util.List<EvaluationDetails<java.lang.Object>>> getAllValueDetailsAsync​(User user)
      Gets the detailed values of all feature flags or settings asynchronously.
      java.util.Map<java.lang.String,​java.lang.Object> getAllValues()
      Gets the values of all feature flags or settings synchronously.
      java.util.Map<java.lang.String,​java.lang.Object> getAllValues​(User user)
      Gets the values of all feature flags or settings synchronously.
      java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>> getAllValuesAsync()
      Gets the values of all feature flags or settings asynchronously.
      java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>> getAllValuesAsync​(User user)
      Gets the values of all feature flags or settings asynchronously.
      ConfigCatHooks getHooks()
      Access to hooks for event subscription.
      <T> java.util.Map.Entry<java.lang.String,​T> getKeyAndValue​(java.lang.Class<T> classOfT, java.lang.String variationId)
      Gets the key of a setting and its value identified by the given Variation ID (analytics).
      <T> java.util.concurrent.CompletableFuture<java.util.Map.Entry<java.lang.String,​T>> getKeyAndValueAsync​(java.lang.Class<T> classOfT, java.lang.String variationId)
      Gets the key of a setting and its value identified by the given Variation ID (analytics).
      <T> T getValue​(java.lang.Class<T> classOfT, java.lang.String key, User user, T defaultValue)
      Gets the value of a feature flag or setting as T identified by the given key.
      <T> T getValue​(java.lang.Class<T> classOfT, java.lang.String key, T defaultValue)
      Gets the value of a feature flag or setting as T identified by the given key.
      <T> java.util.concurrent.CompletableFuture<T> getValueAsync​(java.lang.Class<T> classOfT, java.lang.String key, User user, T defaultValue)
      Gets the value of a feature flag or setting as T asynchronously identified by the given key.
      <T> java.util.concurrent.CompletableFuture<T> getValueAsync​(java.lang.Class<T> classOfT, java.lang.String key, T defaultValue)
      Gets the value of a feature flag or setting as T asynchronously identified by the given key.
      <T> EvaluationDetails<T> getValueDetails​(java.lang.Class<T> classOfT, java.lang.String key, User user, T defaultValue)
      Gets the value of a feature flag or setting as T identified by the given key.
      <T> EvaluationDetails<T> getValueDetails​(java.lang.Class<T> classOfT, java.lang.String key, T defaultValue)
      Gets the value of a feature flag or setting as T identified by the given key.
      <T> java.util.concurrent.CompletableFuture<EvaluationDetails<T>> getValueDetailsAsync​(java.lang.Class<T> classOfT, java.lang.String key, User user, T defaultValue)
      Gets the value of a feature flag or setting as T asynchronously identified by the given key.
      <T> java.util.concurrent.CompletableFuture<EvaluationDetails<T>> getValueDetailsAsync​(java.lang.Class<T> classOfT, java.lang.String key, T defaultValue)
      Gets the value of a feature flag or setting as T asynchronously identified by the given key.
      boolean isClosed()
      Get the client closed status.
      boolean isOffline()
      Get the client offline mode status.
      void setDefaultUser​(User defaultUser)
      Sets defaultUser value.
      void setOffline()
      Set the client to offline mode.
      void setOnline()
      Set the client to online mode.
      • Methods inherited from interface java.io.Closeable

        close
    • Method Detail

      • getValue

        <T> T getValue​(java.lang.Class<T> classOfT,
                       java.lang.String key,
                       T defaultValue)
        Gets the value of a feature flag or setting as T identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        the configuration value identified by the given key.
      • getValue

        <T> T getValue​(java.lang.Class<T> classOfT,
                       java.lang.String key,
                       User user,
                       T defaultValue)
        Gets the value of a feature flag or setting as T identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        user - the user object.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        the configuration value identified by the given key.
      • getValueAsync

        <T> java.util.concurrent.CompletableFuture<T> getValueAsync​(java.lang.Class<T> classOfT,
                                                                    java.lang.String key,
                                                                    T defaultValue)
        Gets the value of a feature flag or setting as T asynchronously identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        a future which computes the configuration value identified by the given key.
      • getValueAsync

        <T> java.util.concurrent.CompletableFuture<T> getValueAsync​(java.lang.Class<T> classOfT,
                                                                    java.lang.String key,
                                                                    User user,
                                                                    T defaultValue)
        Gets the value of a feature flag or setting as T asynchronously identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        user - the user object.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        a future which computes the configuration value identified by the given key.
      • getValueDetails

        <T> EvaluationDetails<T> getValueDetails​(java.lang.Class<T> classOfT,
                                                 java.lang.String key,
                                                 T defaultValue)
        Gets the value of a feature flag or setting as T identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        the result of the evaluation.
      • getValueDetails

        <T> EvaluationDetails<T> getValueDetails​(java.lang.Class<T> classOfT,
                                                 java.lang.String key,
                                                 User user,
                                                 T defaultValue)
        Gets the value of a feature flag or setting as T identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        user - the user object.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        the result of the evaluation.
      • getValueDetailsAsync

        <T> java.util.concurrent.CompletableFuture<EvaluationDetails<T>> getValueDetailsAsync​(java.lang.Class<T> classOfT,
                                                                                              java.lang.String key,
                                                                                              T defaultValue)
        Gets the value of a feature flag or setting as T asynchronously identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        a future which computes the evaluation details.
      • getValueDetailsAsync

        <T> java.util.concurrent.CompletableFuture<EvaluationDetails<T>> getValueDetailsAsync​(java.lang.Class<T> classOfT,
                                                                                              java.lang.String key,
                                                                                              User user,
                                                                                              T defaultValue)
        Gets the value of a feature flag or setting as T asynchronously identified by the given key.
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        key - the identifier of the feature flag or setting.
        user - the user object.
        defaultValue - in case of any failure, this value will be returned.
        Returns:
        a future which computes the evaluation details.
      • getAllValues

        java.util.Map<java.lang.String,​java.lang.Object> getAllValues()
        Gets the values of all feature flags or settings synchronously.
        Returns:
        a collection of all values.
      • getAllValues

        java.util.Map<java.lang.String,​java.lang.Object> getAllValues​(User user)
        Gets the values of all feature flags or settings synchronously.
        Parameters:
        user - the user object.
        Returns:
        a collection of all values.
      • getAllValuesAsync

        java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>> getAllValuesAsync()
        Gets the values of all feature flags or settings asynchronously.
        Returns:
        a future which computes the collection of all values.
      • getAllValuesAsync

        java.util.concurrent.CompletableFuture<java.util.Map<java.lang.String,​java.lang.Object>> getAllValuesAsync​(User user)
        Gets the values of all feature flags or settings asynchronously.
        Parameters:
        user - the user object.
        Returns:
        a future which computes the collection of all values.
      • getAllValueDetails

        java.util.List<EvaluationDetails<java.lang.Object>> getAllValueDetails()
        Gets the detailed values of all feature flags or settings synchronously.
        Returns:
        a collection of all the evaluation results with details
      • getAllValueDetails

        java.util.List<EvaluationDetails<java.lang.Object>> getAllValueDetails​(User user)
        Gets the detailed values of all feature flags or settings synchronously.
        Parameters:
        user - the user object.
        Returns:
        a collection of all the evaluation results with details
      • getAllValueDetailsAsync

        java.util.concurrent.CompletableFuture<java.util.List<EvaluationDetails<java.lang.Object>>> getAllValueDetailsAsync()
        Gets the detailed values of all feature flags or settings asynchronously.
        Returns:
        a future which computes the collection of all detailed values.
      • getAllValueDetailsAsync

        java.util.concurrent.CompletableFuture<java.util.List<EvaluationDetails<java.lang.Object>>> getAllValueDetailsAsync​(User user)
        Gets the detailed values of all feature flags or settings asynchronously.
        Parameters:
        user - the user object.
        Returns:
        a future which computes the collection of all detailed values.
      • getKeyAndValue

        <T> java.util.Map.Entry<java.lang.String,​T> getKeyAndValue​(java.lang.Class<T> classOfT,
                                                                         java.lang.String variationId)
        Gets the key of a setting and its value identified by the given Variation ID (analytics).
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        variationId - the Variation ID.
        Returns:
        the key of a setting and its value.
      • getKeyAndValueAsync

        <T> java.util.concurrent.CompletableFuture<java.util.Map.Entry<java.lang.String,​T>> getKeyAndValueAsync​(java.lang.Class<T> classOfT,
                                                                                                                      java.lang.String variationId)
        Gets the key of a setting and its value identified by the given Variation ID (analytics).
        Type Parameters:
        T - the type of the desired feature flag or setting.
        Parameters:
        classOfT - the class of T. Only String, Integer, Double or Boolean types are supported.
        variationId - the Variation ID.
        Returns:
        a future which computes the key of a setting and its value.
      • getAllKeys

        java.util.Collection<java.lang.String> getAllKeys()
        Gets a collection of all setting keys.
        Returns:
        a collection of all setting keys.
      • getAllKeysAsync

        java.util.concurrent.CompletableFuture<java.util.Collection<java.lang.String>> getAllKeysAsync()
        Gets a collection of all setting keys asynchronously.
        Returns:
        a collection of all setting keys.
      • forceRefresh

        RefreshResult forceRefresh()
        Initiates a force refresh synchronously on the cached configuration.
        Returns:
        the refresh result.
      • forceRefreshAsync

        java.util.concurrent.CompletableFuture<RefreshResult> forceRefreshAsync()
        Initiates a force refresh asynchronously on the cached configuration.
        Returns:
        the future which executes the refresh.
      • setDefaultUser

        void setDefaultUser​(User defaultUser)
        Sets defaultUser value. If no user specified in the following calls {getValue}, {getAllValues}, {getValueDetails}, {getAllValueDetails} the default user value will be used.
        Parameters:
        defaultUser - The new default user.
      • clearDefaultUser

        void clearDefaultUser()
        Set default user value to null.
      • isClosed

        boolean isClosed()
        Get the client closed status.
        Returns:
        True if the client is closed.
      • setOnline

        void setOnline()
        Set the client to online mode. HTTP calls are allowed.
      • setOffline

        void setOffline()
        Set the client to offline mode. HTTP calls are not allowed.
      • isOffline

        boolean isOffline()
        Get the client offline mode status.
        Returns:
        True if the client is in offline mode, otherwise false.
      • getHooks

        ConfigCatHooks getHooks()
        Access to hooks for event subscription.
        Returns:
        the hooks object used for event subscription.