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

com.robertboothby.djenni.sugar.Range 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.sugar;

public abstract class Range {

    private U minimum;
    private U maximum;
    private final T parent;

    protected Range(T parent) {
        this.parent = parent;
    }

    public abstract boolean inclusive();

    @SuppressWarnings("unchecked")
    public And between(U minimum) {
        this.minimum = minimum;
        return maximum -> {
            //TODO throw exception as required.
            this.maximum = maximum;
            return parent;
        };
    }

    public U getMinimum() {
        return minimum;
    }

    public U getMaximum() {
        return maximum;
    }

    public static  Range inclusive(T parent){
        return new Range(parent) {
            @Override
            public boolean inclusive() {
                return true;
            }
        };
    }

    public static  Range exclusive(T parent){
        return new Range(parent) {
            @Override
            public boolean inclusive() {
                return false;
            }
        };
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy