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

com.kenshoo.pl.entity.spi.RequiredFieldValidator Maven / Gradle / Ivy

Go to download

A Java persistence layer based on JOOQ for high performance and business flow support.

There is a newer version: 0.1.121-jooq-3.16.3
Show newest version
package com.kenshoo.pl.entity.spi;

import com.kenshoo.pl.entity.CurrentEntityState;
import com.kenshoo.pl.entity.EntityField;
import com.kenshoo.pl.entity.EntityType;

import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * A validator that force given a value in create command
 *
 * @param  entity type
 * @param  required field type
 */
public interface RequiredFieldValidator, T> extends ChangeValidator {

    /**
     * @return the field that have to be
     */
    EntityField requiredField();

    /**
     * @return the error code to return if the field is missing
     */
    String getErrorCode();

    /**
     * @return Predicate when should validate field.
     */
    default Predicate requireWhen() {
        return e -> true;
    }

    /**
     * @return a list of fields to fetch.
     */
    default Stream> fetchFields() {
        return Stream.of();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy