io.ebean.delegate.DelegateFind Maven / Gradle / Ivy
package io.ebean.delegate;
import io.ebean.EbeanServer;
import io.ebean.FutureIds;
import io.ebean.FutureList;
import io.ebean.FutureRowCount;
import io.ebean.PagedList;
import io.ebean.Query;
import io.ebean.QueryIterator;
import io.ebean.Transaction;
import io.ebean.Version;
import io.ebeaninternal.api.SpiQuery;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Wraps an underlying EbeanServer.
*
* Can you used for testing purposes when you want to create a test double that
* only replaces some of the underlying functionality of the EbeanServer.
*/
public class DelegateFind implements InterceptFind {
protected EbeanServer delegate;
/**
* Construct with a EbeanServer to delegate to by default.
*
* This delegate will be used on all method calls that are not overwritten.
*/
public DelegateFind(EbeanServer delegate) {
this.delegate = delegate;
}
@Override
public void refresh(Object bean) {
delegate.refresh(bean);
}
@Override
public void refreshMany(Object bean, String propertyName) {
delegate.refreshMany(bean, propertyName);
}
@Override
public T findUnique(Query query, Transaction transaction) {
return delegate.findUnique(query, transaction);
}
@Override
public T find(Class beanType, Object id, Transaction transaction) {
return delegate.find(beanType, id, transaction);
}
@Override
public int findCount(Query query, Transaction transaction) {
return delegate.findCount(query, transaction);
}
@Override
public List findIds(Query> query, Transaction transaction) {
return delegate.findIds(query, transaction);
}
@Override
public List findSingleAttributeList(Query> query, Transaction transaction) {
return delegate.findSingleAttributeList(query, transaction);
}
@Override
public QueryIterator findIterate(Query query, Transaction transaction) {
return delegate.findIterate(query, transaction);
}
@Override
public void findEach(Query query, Consumer consumer, Transaction transaction) {
delegate.findEach(query, consumer, transaction);
}
@Override
public void findEachWhile(Query query, Predicate consumer, Transaction transaction) {
delegate.findEachWhile(query, consumer, transaction);
}
@Override
public List findList(Query query, Transaction transaction) {
return delegate.findList(query, transaction);
}
@Override
public FutureRowCount findFutureCount(Query query, Transaction transaction) {
return delegate.findFutureCount(query, transaction);
}
@Override
public FutureIds findFutureIds(Query query, Transaction transaction) {
return delegate.findFutureIds(query, transaction);
}
@Override
public FutureList findFutureList(Query query, Transaction transaction) {
return delegate.findFutureList(query, transaction);
}
@Override
public PagedList findPagedList(Query query, Transaction transaction) {
return delegate.findPagedList(query, transaction);
}
@Override
public Set findSet(Query query, Transaction transaction) {
return delegate.findSet(query, transaction);
}
@Override
public Map findMap(Query query, Transaction transaction) {
return delegate.findMap(query, transaction);
}
@Override
public List> findVersions(Query query, Transaction transaction) {
return delegate.findVersions(query, transaction);
}
}