com.linkedin.restli.client.config.RequestConfigBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of parseq-restli-client Show documentation
Show all versions of parseq-restli-client Show documentation
Uploads all artifacts belonging to configuration ':parseq-restli-client:archives'
/*
* Copyright 2016 LinkedIn, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.linkedin.restli.client.config;
public class RequestConfigBuilder {
private ConfigValue _timeoutMs;
private ConfigValue _batchingEnabled;
private ConfigValue _maxBatchSize;
public RequestConfigBuilder() {
}
public RequestConfigBuilder(RequestConfig config) {
_timeoutMs = config.getTimeoutMs();
_batchingEnabled = config.isBatchingEnabled();
_maxBatchSize = config.getMaxBatchSize();
}
public RequestConfig build() {
return new RequestConfigImpl(_timeoutMs, _batchingEnabled, _maxBatchSize);
}
public ConfigValue getTimeoutMs() {
return _timeoutMs;
}
public RequestConfigBuilder setTimeoutMs(ConfigValue timeoutMs) {
_timeoutMs = timeoutMs;
return this;
}
public ConfigValue getBatchingEnabled() {
return _batchingEnabled;
}
public RequestConfigBuilder setBatchingEnabled(ConfigValue batchingEnabled) {
_batchingEnabled = batchingEnabled;
return this;
}
public ConfigValue getMaxBatchSize() {
return _maxBatchSize;
}
public RequestConfigBuilder setMaxBatchSize(ConfigValue maxBatchSize) {
_maxBatchSize = maxBatchSize;
return this;
}
public RequestConfigBuilder applyOverrides(RequestConfigOverrides configOverrides) {
configOverrides.getTimeoutMs().ifPresent(this::setTimeoutMs);
configOverrides.isBatchingEnabled().ifPresent(this::setBatchingEnabled);
configOverrides.getMaxBatchSize().ifPresent(this::setMaxBatchSize);
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy