<T extends AbstractOption<T, U, V>, U extends AbstractOptionValue<U, T, V>, V>
        T define(Factory<T, U, V> optionFactory, String name, V defaultValue,
                 Function<V, V> validator, BiFunction<U, U, U> mergeFunction) {
            lock();
            try {
                final AbstractOption<?, ?, ?> oldOption = options.get(name);
                if (oldOption != null) {
                    throw new IllegalStateException(
                            '\'' + type.getName() + '#' + name + "' exists already.");
                }

                final T newOption = optionFactory.get(name, defaultValue, validator, mergeFunction);
                checkArgument(type.isInstance(newOption),
                              "OptionFactory.newOption() must return an instance of %s.", type);
                options.put(name, newOption);
                return newOption;
            } finally {
                unlock();
            }
        }
Returns a newly created option with the specified properties.
core/src/main/java/com/linecorp/armeria/common/util/AbstractOption.java