com.kenshoo.pl.entity.FluentEntitiesFetcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of persistence-layer Show documentation
Show all versions of persistence-layer Show documentation
A Java persistence layer based on JOOQ for high performance and business flow support.
package com.kenshoo.pl.entity;
import com.kenshoo.pl.entity.internal.EntitiesFetcher;
import java.util.Collection;
import java.util.List;
import static java.util.Objects.requireNonNull;
class FluentEntitiesFetcher implements FetchFromStep, FetchWhereStep, FetchFinalStep {
private final EntitiesFetcher entitiesFetcher;
private final EntityField, ?>[] fieldsToFetch;
private EntityType> entityType;
private PLCondition condition = PLCondition.trueCondition();
FluentEntitiesFetcher(final EntitiesFetcher entitiesFetcher,
final EntityField, ?>... fieldsToFetch) {
this.entitiesFetcher = requireNonNull(entitiesFetcher, "entitiesFetcher is required");
this.fieldsToFetch = fieldsToFetch;
}
public FetchWhereStep from(final EntityType> entityType) {
this.entityType = entityType;
return this;
}
public FetchFinalStep where(final PLCondition condition) {
this.condition = condition;
return this;
}
public List fetch() {
return entitiesFetcher.fetch(entityType, condition, fieldsToFetch);
}
public List fetchByKeys(Collection extends Identifier>> keys) {
return entitiesFetcher.fetch(entityType, keys, condition, fieldsToFetch);
}
}