com.avaje.ebeaninternal.server.deploy.BeanSetHelp Maven / Gradle / Ivy
package com.avaje.ebeaninternal.server.deploy;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.InvalidValue;
import com.avaje.ebean.Query;
import com.avaje.ebean.Transaction;
import com.avaje.ebean.bean.BeanCollection;
import com.avaje.ebean.bean.BeanCollectionAdd;
import com.avaje.ebean.bean.BeanCollectionLoader;
import com.avaje.ebean.common.BeanSet;
import com.avaje.ebeaninternal.server.text.json.WriteJsonContext;
/**
* Helper specifically for dealing with Sets.
*/
public final class BeanSetHelp implements BeanCollectionHelp {
private final BeanPropertyAssocMany many;
private final BeanDescriptor targetDescriptor;
private BeanCollectionLoader loader;
/**
* When attached to a specific many property.
*/
public BeanSetHelp(BeanPropertyAssocMany many){
this.many = many;
this.targetDescriptor = many.getTargetDescriptor();
}
/**
* For a query that returns a set.
*/
public BeanSetHelp(){
this.many = null;
this.targetDescriptor = null;
}
public void setLoader(BeanCollectionLoader loader){
this.loader = loader;
}
public Iterator> getIterator(Object collection) {
return ((Set>) collection).iterator();
}
public BeanCollectionAdd getBeanCollectionAdd(Object bc,String mapKey) {
if (bc instanceof BeanSet>){
BeanSet> beanSet = (BeanSet>)bc;
if (beanSet.getActualSet() == null){
beanSet.setActualSet(new LinkedHashSet
© 2015 - 2025 Weber Informatics LLC | Privacy Policy