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

com.robertboothby.djenni.util.MapSupplierBuilder Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 0.2.0
Show newest version
package com.robertboothby.djenni.util;

import com.robertboothby.djenni.SupplierBuilder;
import com.robertboothby.djenni.core.StreamableSupplier;

import java.util.Map;
import java.util.function.Supplier;

public class MapSupplierBuilder, K, V> implements SupplierBuilder {

    private final MapType mapType;
    private Supplier contentSupplier;

    private MapSupplierBuilder(MapType mapType) {
        this.mapType = mapType;
    }

    @Override
    public StreamableSupplier build() {
        return () -> mapType.instance(contentSupplier.get());
    }

    public MapSupplierBuilder withContentSupplier(Supplier contentSupplier) {
        this.contentSupplier = contentSupplier;
        return this;
    }

    public MapSupplierBuilder withContentSupplier(SupplierBuilder contentSupplierBuilder) {
        this.contentSupplier = contentSupplierBuilder.build();
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy