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 availableClientFactoryOptions.static <T> ClientFactoryOption<T>Defines a newClientFactoryOptionof 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 newClientFactoryOptionof 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 theClientFactoryOptionwith 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 availableClientFactoryOptions. -
of
Returns theClientFactoryOptionwith the specifiedname.- Throws:
NoSuchElementException- if there's no such option defined.
-
define
Defines a newClientFactoryOptionof 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 newClientFactoryOptionof 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- theFunctionwhich is used for validating and normalizing an option value.mergeFunction- theBiFunctionwhich 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:AbstractOptionImplement this method to return a new option value.- Specified by:
doNewValuein classAbstractOption<ClientFactoryOption<T>,ClientFactoryOptionValue<T>,T>
-