io.ebean.mocker.delegate.DelegateFind Maven / Gradle / Ivy
package io.ebean.mocker.delegate;
import io.ebean.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
/**
* 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 Database 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(Database 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 findOne(Query query, Transaction transaction) {
return delegate.extended().findOne(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.extended().findCount(query, transaction);
}
@Override
public List findIds(Query> query, Transaction transaction) {
return delegate.extended().findIds(query, transaction);
}
@Override
public List findSingleAttributeList(Query> query, Transaction transaction) {
return delegate.extended().findSingleAttributeList(query, transaction);
}
@Override
public QueryIterator findIterate(Query query, Transaction transaction) {
return delegate.extended().findIterate(query, transaction);
}
@Override
public void findEach(Query query, Consumer consumer, Transaction transaction) {
delegate.extended().findEach(query, consumer, transaction);
}
@Override
public void findEach(Query query, int i, Consumer> consumer, Transaction transaction) {
delegate.extended().findEach(query, i, consumer, transaction);
}
@Override
public void findEachWhile(Query query, Predicate consumer, Transaction transaction) {
delegate.extended().findEachWhile(query, consumer, transaction);
}
@Override
public List findList(Query query, Transaction transaction) {
return delegate.extended().findList(query, transaction);
}
@Override
public FutureRowCount findFutureCount(Query query, Transaction transaction) {
return delegate.extended().findFutureCount(query, transaction);
}
@Override
public FutureIds findFutureIds(Query query, Transaction transaction) {
return delegate.extended().findFutureIds(query, transaction);
}
@Override
public FutureList findFutureList(Query query, Transaction transaction) {
return delegate.extended().findFutureList(query, transaction);
}
@Override
public PagedList findPagedList(Query query, Transaction transaction) {
return delegate.extended().findPagedList(query, transaction);
}
@Override
public Set findSet(Query query, Transaction transaction) {
return delegate.extended().findSet(query, transaction);
}
@Override
public Map findMap(Query query, Transaction transaction) {
return delegate.extended().findMap(query, transaction);
}
@Override
public List> findVersions(Query query, Transaction transaction) {
return delegate.extended().findVersions(query, transaction);
}
@Override
public Stream findStream(Query query, Transaction transaction) {
return delegate.extended().findStream(query, transaction);
}
@Override
public boolean exists(Query> query, Transaction transaction) {
return delegate.extended().exists(query, transaction);
}
}