Package com.algolia.search
Class ConfigBase.Builder<T extends ConfigBase.Builder<T>>
- java.lang.Object
-
- com.algolia.search.ConfigBase.Builder<T>
-
- Direct Known Subclasses:
AnalyticsConfig.Builder,InsightsConfig.Builder,PersonalizationConfig.Builder,RecommendationConfig.Builder,SearchConfig.Builder
- Enclosing class:
- ConfigBase
public abstract static class ConfigBase.Builder<T extends ConfigBase.Builder<T>> extends Object
Config base builder to ensure the immutability of the configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected CompressionTypecompressionType
-
Constructor Summary
Constructors Constructor Description Builder(String applicationID, String apiKey, List<StatefulHost> defaultHosts, CompressionType compressionType)Builds a base configuration
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TaddExtraHeaders(String headerKey, String headerValue)Associates the specified value with the specified key in this map.TaddExtraHeaders(Map<String,String> headers)Copies all of the mappings from the specified map to this map.abstract TgetThis()To prevent unchecked cast warning.TsetBatchSize(int batchSize)Overrides the default batch size for save methods.TsetConnectTimeOut(Integer connectTimeOut)Overrides the default connect timeout.TsetExecutorService(ExecutorService executorService)Sets a custom executor service.TsetHosts(List<StatefulHost> customHosts)Sets a list of specific host to target.TsetReadTimeOut(Integer readTimeOut)Overrides the default read timeout.TsetUseSystemProxy(boolean useSystemProxy)Deprecated.Please use a custom HttpAsyncClientBuilder when instantiating the ApacheHttpRequester instead.TsetWriteTimeOut(Integer writeTimeOut)Overrides the default write timeout.
-
-
-
Field Detail
-
compressionType
protected CompressionType compressionType
-
-
Constructor Detail
-
Builder
public Builder(@Nonnull String applicationID, @Nonnull String apiKey, @Nonnull List<StatefulHost> defaultHosts, @Nonnull CompressionType compressionType)
Builds a base configuration- Parameters:
applicationID- The Algolia Application IDapiKey- The API Key: could be Admin API Key or Search API Key- Throws:
NullPointerException- If the ApplicationID or the APIKey or the hosts are nullIllegalArgumentException- If the ApplicationID or the APIKey are empty
-
-
Method Detail
-
getThis
public abstract T getThis()
To prevent unchecked cast warning.
-
setUseSystemProxy
public T setUseSystemProxy(boolean useSystemProxy)
Deprecated.Please use a custom HttpAsyncClientBuilder when instantiating the ApacheHttpRequester instead.Makes the underlying Apache HTTP Client to use JVM/System settings for the proxy.
-
setBatchSize
public T setBatchSize(int batchSize)
Overrides the default batch size for save methods. Default = 1000 objects per chunk.
-
setReadTimeOut
public T setReadTimeOut(Integer readTimeOut)
Overrides the default read timeout. Default = 1000ms In milliseconds
-
setWriteTimeOut
public T setWriteTimeOut(Integer writeTimeOut)
Overrides the default write timeout. Default = 30000ms In milliseconds
-
setConnectTimeOut
public T setConnectTimeOut(Integer connectTimeOut)
Overrides the default connect timeout. Default = 2000ms In milliseconds
-
setHosts
public T setHosts(@Nonnull List<StatefulHost> customHosts)
Sets a list of specific host to target. Default hosts will be overridden.
-
setExecutorService
public T setExecutorService(ExecutorService executorService)
Sets a custom executor service. Default ForkJoinPool will be overridden.
-
addExtraHeaders
public T addExtraHeaders(@Nonnull String headerKey, @Nonnull String headerValue)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
-
-