public static class FlagsmithClient.Builder extends Object
| Modifier and Type | Method and Description |
|---|---|
FlagsmithClient |
build()
Builds a FlagsmithClient.
|
FlagsmithClient.Builder |
enableLogging()
Enables logging, the project importing this module must include an implementation slf4j in
their pom.
|
FlagsmithClient.Builder |
enableLogging(FlagsmithLoggerLevel level)
Enables logging, the project importing this module must include an implementation slf4j in
their pom.
|
FlagsmithClient.Builder |
setApiKey(String apiKey)
Set the environment API key.
|
FlagsmithClient.Builder |
setDefaultFlagValueFunction(@NonNull Function<String,BaseFlag> defaultFlagValueFunction)
When a flag does not exist in Flagsmith or there is an error, the SDK will return null by
default.
|
FlagsmithClient.Builder |
withApiUrl(String apiUrl)
Set the base URL for Flagsmith API, overriding default one.
|
FlagsmithClient.Builder |
withCache(FlagsmithCacheConfig cacheConfig)
Enable in-memory caching for the Flagsmith API.
|
FlagsmithClient.Builder |
withConfiguration(FlagsmithConfig config)
Override default FlagsmithConfig for Flagsmith API.
|
FlagsmithClient.Builder |
withCustomHttpHeaders(HashMap<String,String> customHeaders)
Add custom HTTP headers to the calls.
|
FlagsmithClient.Builder |
withPollingManager(PollingManager manager)
Set the polling manager.
|
public FlagsmithClient.Builder setApiKey(String apiKey)
apiKey - the api key for environmentpublic FlagsmithClient.Builder setDefaultFlagValueFunction(@NonNull @NonNull Function<String,BaseFlag> defaultFlagValueFunction)
If you would like to override this default behaviour, you can use this method. By default it will return null for any flags that it does not recognise.
defaultFlagValueFunction - the new function to use as default flag valuespublic FlagsmithClient.Builder enableLogging(FlagsmithLoggerLevel level)
level - log error level.public FlagsmithClient.Builder enableLogging()
public FlagsmithClient.Builder withConfiguration(FlagsmithConfig config)
config - an FlagsmithConfig to override default one.public FlagsmithClient.Builder withApiUrl(String apiUrl)
apiUrl - the new base URI for the API.public FlagsmithClient.Builder withCustomHttpHeaders(HashMap<String,String> customHeaders)
customHeaders - headers.public FlagsmithClient.Builder withCache(FlagsmithCacheConfig cacheConfig)
If no other cache configuration is set, the Caffeine defaults will be used, i.e. no limit
cacheConfig - an FlagsmithCacheConfig.public FlagsmithClient.Builder withPollingManager(PollingManager manager)
manager - polling manager objectpublic FlagsmithClient build()
Copyright © 2022. All rights reserved.