#708 - Refactor - Remove BeanCollectionTouched interface

This commit is contained in:
Robin Bygrave
2016-05-18 10:13:03 +12:00
parent f181e3946f
commit 1c9b974427
6 changed files with 3 additions and 76 deletions
@@ -92,11 +92,6 @@ public interface BeanCollection<E> extends Serializable {
*/
void setFilterMany(ExpressionList<?> filterMany);
/**
* Set a listener to be notified when the BeanCollection is first touched.
*/
void setBeanCollectionTouched(BeanCollectionTouched notify);
/**
* Return true if the collection has been registered with the batch loading context.
*/
@@ -1,20 +0,0 @@
package com.avaje.ebean.bean;
/**
* Used to specify a listener to be notified when a BeanCollection is first
* used.
* <p>
* To use this you can set a BeanCollectionTouched onto a BeanCollection before
* it has been used. When the BeanCollection is first used by the client code
* then the BeanCollectionTouched is notified. It can only be notified once.
* </p>
*
* @author rbygrave
*/
public interface BeanCollectionTouched {
/**
* Notify the listener that the bean collection has been used.
*/
void notifyTouched(BeanCollection<?> c);
}
@@ -1,16 +1,14 @@
package com.avaje.ebean.common;
import java.util.Set;
import javax.persistence.PersistenceException;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.bean.BeanCollection;
import com.avaje.ebean.bean.BeanCollectionLoader;
import com.avaje.ebean.bean.BeanCollectionTouched;
import com.avaje.ebean.bean.EntityBean;
import javax.persistence.PersistenceException;
import java.util.Set;
/**
* Base class for List Set and Map implementations of BeanCollection.
*
@@ -36,8 +34,6 @@ public abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
protected String ebeanServerName;
protected transient BeanCollectionTouched beanCollectionTouched;
/**
* The owning bean (used for lazy fetch).
*/
@@ -117,15 +113,6 @@ public abstract class AbstractBeanCollection<E> implements BeanCollection<E> {
if (setFlag) {
touched = true;
}
if (beanCollectionTouched != null) {
// only call this once
beanCollectionTouched.notifyTouched(this);
beanCollectionTouched = null;
}
}
public void setBeanCollectionTouched(BeanCollectionTouched notify) {
this.beanCollectionTouched = notify;
}
public boolean isRegisteredWithLoadContext() {
@@ -5,7 +5,6 @@ import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.OrderBy;
import com.avaje.ebean.PersistenceContextScope;
import com.avaje.ebean.Query;
import com.avaje.ebean.bean.BeanCollectionTouched;
import com.avaje.ebean.bean.CallStack;
import com.avaje.ebean.bean.ObjectGraphNode;
import com.avaje.ebean.bean.PersistenceContext;
@@ -226,18 +225,6 @@ public interface SpiQuery<T> extends Query<T> {
List<String> getSoftDeletePredicates();
/**
* Return a listener that wants to be notified when the bean collection is
* first used.
*/
BeanCollectionTouched getBeanCollectionTouched();
/**
* Set a listener to be notified when the bean collection has been touched
* (when the list/set/map is first used).
*/
void setBeanCollectionTouched(BeanCollectionTouched notify);
/**
* Set the list of Id's that is being populated.
* <p>
@@ -4,7 +4,6 @@ import com.avaje.ebean.QueryIterator;
import com.avaje.ebean.ValuePair;
import com.avaje.ebean.Version;
import com.avaje.ebean.bean.BeanCollection;
import com.avaje.ebean.bean.BeanCollectionTouched;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.bean.ObjectGraphNode;
import com.avaje.ebean.config.dbplatform.DatabasePlatform;
@@ -300,14 +299,6 @@ public class CQueryEngine {
}
BeanCollection<T> beanCollection = cquery.readCollection();
BeanCollectionTouched collectionTouched = query.getBeanCollectionTouched();
if (collectionTouched != null) {
// register a listener that wants to be notified when the
// bean collection is first used
beanCollection.setBeanCollectionTouched(collectionTouched);
}
if (request.isLogSummary()) {
logFindManySummary(cquery);
}
@@ -2,7 +2,6 @@ package com.avaje.ebeaninternal.server.querydefn;
import com.avaje.ebean.*;
import com.avaje.ebean.OrderBy.Property;
import com.avaje.ebean.bean.BeanCollectionTouched;
import com.avaje.ebean.bean.CallStack;
import com.avaje.ebean.bean.ObjectGraphNode;
import com.avaje.ebean.bean.ObjectGraphOrigin;
@@ -48,8 +47,6 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
private final EbeanServer server;
private BeanCollectionTouched beanCollectionTouched;
private final ExpressionFactory expressionFactory;
/**
@@ -1526,16 +1523,6 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return disableReadAudit;
}
@Override
public void setBeanCollectionTouched(BeanCollectionTouched notify) {
this.beanCollectionTouched = notify;
}
@Override
public BeanCollectionTouched getBeanCollectionTouched() {
return beanCollectionTouched;
}
@Override
public List<Object> getIdList() {
return partialIds;