class Builder {

        private boolean timeoutCommands = DEFAULT_TIMEOUT_COMMANDS;

        private boolean applyConnectionTimeout = false;

        private TimeoutSource source;

        /**
         * Enable command timeouts. Disabled by default, see {@link #DEFAULT_TIMEOUT_COMMANDS}.
         *
         * @return {@code this}
         */
        public Builder timeoutCommands() {
            return timeoutCommands(true);
        }

        /**
         * Configure whether commands should timeout. Disabled by default, see {@link #DEFAULT_TIMEOUT_COMMANDS}.
         *
         * @param enabled {@code true} to enable timeout; {@code false} to disable timeouts.
         * @return {@code this}
         */
        public Builder timeoutCommands(boolean enabled) {

            this.timeoutCommands = enabled;
            return this;
        }

        /**
         * Set a fixed timeout for all commands.
         *
         * @param duration the timeout {@link Duration}, must not be {@code null}.
         * @return {@code this}
         */
        public Builder fixedTimeout(Duration duration) {<FILL_FUNCTION_BODY>}

        /**
         * Configure a {@link TimeoutSource} that applies timeouts configured on the connection/client instance.
         *
         * @return {@code this}
         */
        public Builder connectionTimeout() {
            return timeoutSource(new DefaultTimeoutSource());
        }

        /**
         * Set a {@link TimeoutSource} to obtain the timeout value per {@link RedisCommand}.
         *
         * @param source the timeout source.
         * @return {@code this}
         */
        public Builder timeoutSource(TimeoutSource source) {

            LettuceAssert.notNull(source, "TimeoutSource must not be null");

            timeoutCommands(true);
            this.applyConnectionTimeout = source instanceof DefaultTimeoutSource;
            this.source = source;
            return this;
        }

        /**
         * Create a new instance of {@link TimeoutOptions}.
         *
         * @return new instance of {@link TimeoutOptions}
         */
        public TimeoutOptions build() {

            if (timeoutCommands) {
                if (source == null) {
                    throw new IllegalStateException("TimeoutSource is required for enabled timeouts");
                }
            }

            return new TimeoutOptions(timeoutCommands, applyConnectionTimeout, source);
        }

    }


            LettuceAssert.notNull(duration, "Duration must not be null");

            return timeoutSource(new FixedTimeoutSource(duration.toNanos(), TimeUnit.NANOSECONDS));
        
<no_super_class>