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<?,
?, ?>>
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> -
Method Summary
Modifier and TypeMethodDescriptionstatic Set<ClientOption<?>>
Returns the all availableClientOption
s.static <T> ClientOption<T>
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<?>
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
-
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>
-