Package com.linecorp.armeria.client
Class ClientOption<T>
java.lang.Object
com.linecorp.armeria.common.util.AbstractOption<ClientOption<T>,ClientOptionValue<T>,T>
com.linecorp.armeria.client.ClientOption<T>
- Type Parameters:
T
- the type of the option value
- All Implemented Interfaces:
Comparable<AbstractOption<?,?,?>>
public final class ClientOption<T> extends AbstractOption<ClientOption<T>,ClientOptionValue<T>,T>
A client option.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.linecorp.armeria.common.util.AbstractOption
AbstractOption.Factory<T extends AbstractOption<T,U,V>,U extends AbstractOptionValue<U,T,V>,V>
-
Field Summary
Fields Modifier and Type Field Description static ClientOption<ClientDecoration>
DECORATION
TheFunction
that decorates the client components.static ClientOption<Function<? super Endpoint,? extends EndpointGroup>>
ENDPOINT_REMAPPER
static ClientOption<ClientFactory>
FACTORY
TheClientFactory
used for creating a client.static ClientOption<HttpHeaders>
HTTP_HEADERS
The additional HTTP headers to send with requests.static ClientOption<Long>
MAX_RESPONSE_LENGTH
The maximum allowed length of a server response.static ClientOption<Supplier<RequestId>>
REQUEST_ID_GENERATOR
static ClientOption<Long>
RESPONSE_TIMEOUT_MILLIS
The timeout of a server reply to a client call.static ClientOption<Long>
WRITE_TIMEOUT_MILLIS
The timeout of a socket write. -
Method Summary
Modifier and Type Method Description static Set<ClientOption<?>>
allOptions()
Returns the all availableClientOption
s.static <T> ClientOption<T>
define(String name, T defaultValue)
Defines a newClientOption
of the specified name and default value.static <T> ClientOption<T>
define(String name, T defaultValue, Function<T,T> validator, BiFunction<ClientOptionValue<T>,ClientOptionValue<T>,ClientOptionValue<T>> mergeFunction)
Defines a newClientOption
of the specified name, default value and merge function.protected ClientOptionValue<T>
doNewValue(T value)
Implement this method to return a new option value.static ClientOption<?>
of(String name)
Returns theClientOption
with the specifiedname
.Methods inherited from class com.linecorp.armeria.common.util.AbstractOption
allOptions, compareTo, defaultValue, define, equals, hashCode, name, newValue, of, toString
-
Field Details
-
FACTORY
TheClientFactory
used for creating a client. -
WRITE_TIMEOUT_MILLIS
The timeout of a socket write. -
RESPONSE_TIMEOUT_MILLIS
The timeout of a server reply to a client call. -
MAX_RESPONSE_LENGTH
The maximum allowed length of a server response. -
HTTP_HEADERS
The additional HTTP headers to send with requests. -
DECORATION
TheFunction
that decorates the client components. -
REQUEST_ID_GENERATOR
-
ENDPOINT_REMAPPER
public static final ClientOption<Function<? super Endpoint,? extends EndpointGroup>> ENDPOINT_REMAPPER- See Also:
ClientBuilder.endpointRemapper(Function)
-
-
Method Details
-
allOptions
Returns the all availableClientOption
s. -
of
Returns theClientOption
with the specifiedname
.- Throws:
NoSuchElementException
- if there's no such option defined.
-
define
Defines a newClientOption
of the specified name and default value.- Parameters:
name
- the name of the option.defaultValue
- the default value of the option, which will be used when unspecified.- Throws:
IllegalStateException
- if an option with the specified name exists already.
-
define
public static <T> ClientOption<T> define(String name, T defaultValue, Function<T,T> validator, BiFunction<ClientOptionValue<T>,ClientOptionValue<T>,ClientOptionValue<T>> mergeFunction)Defines a newClientOption
of the specified name, default value and merge function.- Parameters:
name
- the name of the option.defaultValue
- the default value of the option, which will be used when unspecified.validator
- theFunction
which is used for validating and normalizing an option value.mergeFunction
- theBiFunction
which is used for merging old and new option values.- Throws:
IllegalStateException
- if an option with the specified name exists already.
-
doNewValue
Description copied from class:AbstractOption
Implement this method to return a new option value.- Specified by:
doNewValue
in classAbstractOption<ClientOption<T>,ClientOptionValue<T>,T>
-