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

com.kenshoo.pl.entity.internal.LazyDelegatingMultiSupplier 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.internal;

import com.kenshoo.pl.entity.ChangeOperation;
import com.kenshoo.pl.entity.CurrentEntityState;
import com.kenshoo.pl.entity.EntityField;
import com.kenshoo.pl.entity.EntityType;
import com.kenshoo.pl.entity.FieldsValueMap;
import com.kenshoo.pl.entity.spi.MultiFieldValueSupplier;
import com.kenshoo.pl.entity.spi.ValidationException;

import java.util.stream.Stream;

/**
 * Created by yuvalr on 2/15/16.
 */
public class LazyDelegatingMultiSupplier> implements MultiFieldValueSupplier {

    private final MultiFieldValueSupplier multiSupplier;
    private FieldsValueMap suppliedMap;

    public LazyDelegatingMultiSupplier(MultiFieldValueSupplier multiSupplier) {
        this.multiSupplier = multiSupplier;
    }

    @Override
    public FieldsValueMap supply(CurrentEntityState currentState) throws ValidationException {
        if (suppliedMap == null) {
            suppliedMap = multiSupplier.supply(currentState);
        }
        return suppliedMap;
    }

    @Override
    public Stream> fetchFields(ChangeOperation changeOperation) {
        return multiSupplier.fetchFields(changeOperation);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy