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

dev.marksman.kraftwerk.Constant Maven / Gradle / Ivy

The newest version!
package dev.marksman.kraftwerk;

import com.jnape.palatable.lambda.adt.Maybe;

import static dev.marksman.kraftwerk.Result.result;

final class Constant implements Generator {
    private static final Maybe LABEL = Maybe.just("constant");

    private final A value;

    private Constant(A value) {
        this.value = value;
    }

    static  Constant constant(A value) {
        return new Constant<>(value);
    }

    @Override
    public GenerateFn createGenerateFn(GeneratorParameters generatorParameters) {
        return input -> result(input, value);
    }

    @Override
    public Maybe getLabel() {
        return LABEL;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy