com.robertboothby.djenni.SupplierBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
This module holds the core components of the Djenni data generator framework. By itself it provides most of the
components to create an efficient end to end data generation framework for a specific domain. It contains the
core
SupplierBuilder interfaces, implementations for the core Java data types and useful test components.
It is intended to be used in conjunction with the source-generator module that will speed up delivery of domain
specific data generation and also with common domain modules (TBD) that deliver standard generators for common
frameworks such as JAXB.
package com.robertboothby.djenni;
import com.robertboothby.djenni.core.StreamableSupplier;
import java.util.function.Consumer;
/**
* A builder of object Suppliers, implementing the 'Builder' pattern. Instances of this interface will usually
* be not thread safe and highly mutable.
* @author robertboothby
* @param The type of the value that will be supplied.
*/
public interface SupplierBuilder {
/**
* Build an instance of the generator based on the current configuration state.
* @return an instance of the generator.
*/
StreamableSupplier build();
/**
* Utility method to make it easier to build a supplier from a supplier builder with a configuration consumer.
* @param supplierBuilder The supplier builder to configure and use.
* @param configuration The configuration to use.
* @param The type of values to be supplied by the supplier being created.
* @param The type of the SupplierBuilder.
* @return A configured supplier based on the previous configuration of the supplier builder and the newly applied configuration.
*/
static > StreamableSupplier buildConfig(U supplierBuilder, Consumer configuration){
configuration.accept(supplierBuilder);
return supplierBuilder.build();
}
}