All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hyperfoil.api.config.ServiceLoadedContract Maven / Gradle / Ivy

There is a newer version: 0.27
Show newest version
package io.hyperfoil.api.config;

import java.util.function.Consumer;

/**
 * Fill-in the builder provided in {@link #builder()} and then call {@link #complete()}.
 */
public final class ServiceLoadedContract {
   private final B builder;
   private final Consumer consumer;

   public ServiceLoadedContract(B builder, Consumer consumer) {
      this.builder = builder;
      this.consumer = consumer;
   }

   public B builder() {
      return builder;
   }

   public void complete() {
      consumer.accept(builder);
   }
}