Package com.linecorp.armeria.client
Class ClientFactoryOption<T>
java.lang.Object
com.linecorp.armeria.common.util.AbstractOption<ClientFactoryOption<T>,ClientFactoryOptionValue<T>,T>
com.linecorp.armeria.client.ClientFactoryOption<T>
- Type Parameters:
T
- the type of the option value
- All Implemented Interfaces:
Comparable<AbstractOption<?,
?, ?>>
public final class ClientFactoryOption<T>
extends AbstractOption<ClientFactoryOption<T>,ClientFactoryOptionValue<T>,T>
A
ClientFactory
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
<ClientFactoryOption<?>> Returns the all availableClientFactoryOption
s.static <T> ClientFactoryOption
<T> Defines a newClientFactoryOption
of the specified name and default value.static <T> ClientFactoryOption
<T> define
(String name, T defaultValue, Function<T, T> validator, BiFunction<ClientFactoryOptionValue<T>, ClientFactoryOptionValue<T>, ClientFactoryOptionValue<T>> mergeFunction) Defines a newClientFactoryOption
of the specified name, default value and merge function.protected ClientFactoryOptionValue
<T> doNewValue
(T value) Implement this method to return a new option value.static ClientFactoryOption
<?> Returns theClientFactoryOption
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 availableClientFactoryOption
s. -
of
Returns theClientFactoryOption
with the specifiedname
.- Throws:
NoSuchElementException
- if there's no such option defined.
-
define
Defines a newClientFactoryOption
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> ClientFactoryOption<T> define(String name, T defaultValue, Function<T, T> validator, BiFunction<ClientFactoryOptionValue<T>, ClientFactoryOptionValue<T>, ClientFactoryOptionValue<T>> mergeFunction) Defines a newClientFactoryOption
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<ClientFactoryOption<T>,
ClientFactoryOptionValue<T>, T>
-