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

com.kenshoo.pl.entity.spi.CurrentStateConsumer 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.*;

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

/**
 * This interface is implemented by pluggable components that require the current state of entities. For instance, a validator
 * that needs a profile ID of an entity, would indirectly implement this interface.
 * Client classes should not implement this interface directly, it is used internally by the framework.
 */
public interface CurrentStateConsumer> {

    default SupportedChangeOperation getSupportedChangeOperation() {
        return SupportedChangeOperation.CREATE_UPDATE_AND_DELETE;
    }

    default Stream> requiredFields(Collection> fieldsToUpdate, ChangeOperation changeOperation) {
        return Stream.empty();
    }


    static > Predicate> supporting(ChangeOperation op) {
        return consumer -> consumer.getSupportedChangeOperation().supports(op);
    }

    static > Predicate supporting(CurrentStateConsumer consumer) {
        return op -> consumer.getSupportedChangeOperation().supports(op);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy