@@ -362,7 +362,14 @@ private void backoffIfNeeded(BackOff backOff, Sleeper sleeper) {
362362 abstract static class Configuration <RequestT , ResponseT > implements Serializable {
363363
364364 static <RequestT , ResponseT > Builder <RequestT , ResponseT > builder () {
365- return new AutoValue_Call_Configuration .Builder <RequestT , ResponseT >();
365+ return new AutoValue_Call_Configuration .Builder <RequestT , ResponseT >()
366+ .setShouldRepeat (false )
367+ .setTimeout (RequestResponseIO .DEFAULT_TIMEOUT )
368+ .setCallShouldBackoff (new NoopCallShouldBackoff <>())
369+ .setSleeperSupplier ((SerializableSupplier <Sleeper >) () -> Sleeper .DEFAULT )
370+ .setBackOffSupplier (new DefaultSerializableBackoffSupplier ())
371+ .setMonitoringConfiguration (Monitoring .builder ().build ())
372+ .setSetupTeardown (new NoopSetupTeardown ());
366373 }
367374
368375 /** The user custom code that converts a {@link RequestT} into a {@link ResponseT}. */
@@ -438,7 +445,7 @@ abstract static class Builder<RequestT, ResponseT> {
438445 /** See {@link Configuration#getTimeout}. */
439446 abstract Builder <RequestT , ResponseT > setTimeout (Duration value );
440447
441- abstract Optional < Duration > getTimeout ();
448+ abstract Duration getTimeout ();
442449
443450 /** See {@link Configuration#getShouldRepeat}. */
444451 abstract Builder <RequestT , ResponseT > setShouldRepeat (boolean value );
@@ -449,49 +456,25 @@ abstract static class Builder<RequestT, ResponseT> {
449456 abstract Builder <RequestT , ResponseT > setCallShouldBackoff (
450457 CallShouldBackoff <ResponseT > value );
451458
452- abstract Optional < CallShouldBackoff <ResponseT > > getCallShouldBackoff ();
459+ abstract CallShouldBackoff <ResponseT > getCallShouldBackoff ();
453460
454461 /** See {@link Configuration#getSleeperSupplier}. */
455462 abstract Builder <RequestT , ResponseT > setSleeperSupplier (SerializableSupplier <Sleeper > value );
456463
457- abstract Optional < SerializableSupplier <Sleeper > > getSleeperSupplier ();
464+ abstract SerializableSupplier <Sleeper > getSleeperSupplier ();
458465
459466 /** See {@link Configuration#getBackOffSupplier}. */
460467 abstract Builder <RequestT , ResponseT > setBackOffSupplier (SerializableSupplier <BackOff > value );
461468
462- abstract Optional < SerializableSupplier <BackOff > > getBackOffSupplier ();
469+ abstract SerializableSupplier <BackOff > getBackOffSupplier ();
463470
464471 abstract Builder <RequestT , ResponseT > setMonitoringConfiguration (Monitoring value );
465472
466- abstract Optional < Monitoring > getMonitoringConfiguration ();
473+ abstract Monitoring getMonitoringConfiguration ();
467474
468475 abstract Configuration <RequestT , ResponseT > autoBuild ();
469476
470477 final Configuration <RequestT , ResponseT > build () {
471- if (!getSetupTeardown ().isPresent ()) {
472- setSetupTeardown (new NoopSetupTeardown ());
473- }
474-
475- if (!getTimeout ().isPresent ()) {
476- setTimeout (RequestResponseIO .DEFAULT_TIMEOUT );
477- }
478-
479- if (!getCallShouldBackoff ().isPresent ()) {
480- setCallShouldBackoff (new NoopCallShouldBackoff <>());
481- }
482-
483- if (!getSleeperSupplier ().isPresent ()) {
484- setSleeperSupplier ((SerializableSupplier <Sleeper >) () -> Sleeper .DEFAULT );
485- }
486-
487- if (!getBackOffSupplier ().isPresent ()) {
488- setBackOffSupplier (new DefaultSerializableBackoffSupplier ());
489- }
490-
491- if (!getMonitoringConfiguration ().isPresent ()) {
492- setMonitoringConfiguration (Monitoring .builder ().build ());
493- }
494-
495478 return autoBuild ();
496479 }
497480 }
0 commit comments