// Path: hibernate/src/main/java/net/sf/beanlib/hibernate5/Hibernate5BeanReplicator.java
// public class Hibernate5BeanReplicator extends HibernateBeanReplicator {
// 
//     /**
//      * By default, all properties will be included for replication.
//      */
//     public Hibernate5BeanReplicator() {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter()));
//     }
// 
//     /**
//      * Constructs with an application package prefix.
//      *
//      * @param applicationPackagePrefix An application package prefix used to determine if a property with a type of an
//      *            entity bean class will be included for replication.
//      */
//     public Hibernate5BeanReplicator(String applicationPackagePrefix) {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter(applicationPackagePrefix)));
//     }
// 
//     /**
//      * Convenient constructor to specify:
//      * <ol>
//      * <li>The set of entity bean classes for matching properties that will be replicated;</li>
//      * <li>The set of collection and map properties that will be replicated;</li>
//      * <li>A {@link PropertyFilter vetoer} used to veto the propagation of specific properties</li>
//      * </ol>
//      * <p>
//      * Note this constructor is relevant only if the default property filter {@link HibernatePropertyFilter} is used.
//      *
//      * @param entityBeanClassSet The set of entity bean classes for matching properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param collectionPropertyNameSet The set of collection and map properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param vetoer used to veto the propagation of specific properties.
//      */
//     public Hibernate5BeanReplicator(Set<Class<?>> entityBeanClassSet, Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet,
//             PropertyFilter vetoer) {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter().withEntityBeanClassSet(entityBeanClassSet)
//                 .withCollectionPropertyNameSet(collectionPropertyNameSet).withVetoer(vetoer)));
//     }
// 
//     /**
//      * Convenient constructor to specify:
//      * <ol>
//      * <li>An application package prefix used to determine if a property with a type of an entity bean class will be
//      * included for replication;</li>
//      * <li>The set of entity bean classes for matching properties that will be replicated;</li>
//      * <li>The set of collection and map properties that will be replicated;</li>
//      * <li>A {@link PropertyFilter vetoer} used to veto the propagation of specific properties</li>
//      * </ol>
//      * <p>
//      * Note this constructor is relevant only if the default property filter {@link HibernatePropertyFilter} is used.
//      *
//      * @param entityBeanClassSet The set of entity bean classes for matching properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param collectionPropertyNameSet The set of collection and map properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param vetoer used to veto the propagation of specific properties.
//      */
//     public Hibernate5BeanReplicator(String applicationPackagePrefix, Set<Class<?>> entityBeanClassSet,
//             Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet, PropertyFilter vetoer) {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter(applicationPackagePrefix)
//                 .withEntityBeanClassSet(entityBeanClassSet).withCollectionPropertyNameSet(collectionPropertyNameSet).withVetoer(vetoer)));
//     }
// }
// 
// Path: core/src/main/java/net/sf/beanlib/spi/PropertyFilter.java
// public interface PropertyFilter {
// 
//     /**
//      * Returns true if the given JavaBean property should be propagated; false otherwise.
//      *
//      * @param propertyName JavaBean property name.
//      * @param readerMethod reader method of the JavaBean property name.
//      * @return true if the given JavaBean property should be propagated.
//      */
//     boolean propagate(String propertyName, Method readerMethod);
// }


import net.sf.beanlib.hibernate5.Hibernate5BeanReplicator;
import net.sf.beanlib.spi.PropertyFilter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
    public void copyMap() {
        FooWithMap fooMap = new FooWithMap(null);
        fooMap.addToMap("1", "a");
        fooMap.addToMap("2", "b");

        {
            FooWithMap toFooWithMap = new Hibernate5BeanReplicator().copy(fooMap);
            Map<Object, Object> toMap = toFooWithMap.getMap();
            toMap.size();
            // log.info("toMap.size()=" + toMap.size());
            assertEquals(toMap.size(), 2);
        }
        {
            Hibernate5BeanReplicator r = new Hibernate5BeanReplicator();
            r.getHibernatePropertyFilter().withCollectionPropertyNameSet(null);
            FooWithMap toFooWithMap = r.copy(fooMap);
            Map<Object, Object> toMap = toFooWithMap.getMap();
            toMap.size();
            // log.info("toMap.size()=" + toMap.size());
            assertEquals(toMap.size(), 2);
        }
        {
            Hibernate5BeanReplicator r = new Hibernate5BeanReplicator();
            r.getHibernatePropertyFilter().withCollectionPropertyNameSet(Collections.EMPTY_SET);
            FooWithMap toFooWithMap = r.copy(fooMap);
            Map<Object, Object> toMap = toFooWithMap.getMap();
            assertNull(toMap);
        }
        {
            Hibernate5BeanReplicator r = new Hibernate5BeanReplicator();
// Path: hibernate/src/main/java/net/sf/beanlib/hibernate5/Hibernate5BeanReplicator.java
// public class Hibernate5BeanReplicator extends HibernateBeanReplicator {
// 
//     /**
//      * By default, all properties will be included for replication.
//      */
//     public Hibernate5BeanReplicator() {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter()));
//     }
// 
//     /**
//      * Constructs with an application package prefix.
//      *
//      * @param applicationPackagePrefix An application package prefix used to determine if a property with a type of an
//      *            entity bean class will be included for replication.
//      */
//     public Hibernate5BeanReplicator(String applicationPackagePrefix) {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter(applicationPackagePrefix)));
//     }
// 
//     /**
//      * Convenient constructor to specify:
//      * <ol>
//      * <li>The set of entity bean classes for matching properties that will be replicated;</li>
//      * <li>The set of collection and map properties that will be replicated;</li>
//      * <li>A {@link PropertyFilter vetoer} used to veto the propagation of specific properties</li>
//      * </ol>
//      * <p>
//      * Note this constructor is relevant only if the default property filter {@link HibernatePropertyFilter} is used.
//      *
//      * @param entityBeanClassSet The set of entity bean classes for matching properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param collectionPropertyNameSet The set of collection and map properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param vetoer used to veto the propagation of specific properties.
//      */
//     public Hibernate5BeanReplicator(Set<Class<?>> entityBeanClassSet, Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet,
//             PropertyFilter vetoer) {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter().withEntityBeanClassSet(entityBeanClassSet)
//                 .withCollectionPropertyNameSet(collectionPropertyNameSet).withVetoer(vetoer)));
//     }
// 
//     /**
//      * Convenient constructor to specify:
//      * <ol>
//      * <li>An application package prefix used to determine if a property with a type of an entity bean class will be
//      * included for replication;</li>
//      * <li>The set of entity bean classes for matching properties that will be replicated;</li>
//      * <li>The set of collection and map properties that will be replicated;</li>
//      * <li>A {@link PropertyFilter vetoer} used to veto the propagation of specific properties</li>
//      * </ol>
//      * <p>
//      * Note this constructor is relevant only if the default property filter {@link HibernatePropertyFilter} is used.
//      *
//      * @param entityBeanClassSet The set of entity bean classes for matching properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param collectionPropertyNameSet The set of collection and map properties that will be replicated, eagerly
//      *            fetching if necessary. Null means all whereas empty means none.
//      * @param vetoer used to veto the propagation of specific properties.
//      */
//     public Hibernate5BeanReplicator(String applicationPackagePrefix, Set<Class<?>> entityBeanClassSet,
//             Set<? extends CollectionPropertyName<?>> collectionPropertyNameSet, PropertyFilter vetoer) {
//         super(new Hibernate5BeanTransformer().initPropertyFilter(new HibernatePropertyFilter(applicationPackagePrefix)
//                 .withEntityBeanClassSet(entityBeanClassSet).withCollectionPropertyNameSet(collectionPropertyNameSet).withVetoer(vetoer)));
//     }
// }
// 
// Path: core/src/main/java/net/sf/beanlib/spi/PropertyFilter.java
// public interface PropertyFilter {
// 
//     /**
//      * Returns true if the given JavaBean property should be propagated; false otherwise.
//      *
//      * @param propertyName JavaBean property name.
//      * @param readerMethod reader method of the JavaBean property name.
//      * @return true if the given JavaBean property should be propagated.
//      */
//     boolean propagate(String propertyName, Method readerMethod);
// }


// Path: hibernate/src/test/java/net/sf/beanlib/hibernate5/HibernateBeanReplicatorTestMap.java
import net.sf.beanlib.hibernate5.Hibernate5BeanReplicator;
import net.sf.beanlib.spi.PropertyFilter;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Iterator;
import java.util.Map;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

    public void copyMap() {
        FooWithMap fooMap = new FooWithMap(null);
        fooMap.addToMap("1", "a");
        fooMap.addToMap("2", "b");

        {
            FooWithMap toFooWithMap = new Hibernate5BeanReplicator().copy(fooMap);
            Map<Object, Object> toMap = toFooWithMap.getMap();
            toMap.size();
            // log.info("toMap.size()=" + toMap.size());
            assertEquals(toMap.size(), 2);
        }
        {
            Hibernate5BeanReplicator r = new Hibernate5BeanReplicator();
            r.getHibernatePropertyFilter().withCollectionPropertyNameSet(null);
            FooWithMap toFooWithMap = r.copy(fooMap);
            Map<Object, Object> toMap = toFooWithMap.getMap();
            toMap.size();
            // log.info("toMap.size()=" + toMap.size());
            assertEquals(toMap.size(), 2);
        }
        {
            Hibernate5BeanReplicator r = new Hibernate5BeanReplicator();
            r.getHibernatePropertyFilter().withCollectionPropertyNameSet(Collections.EMPTY_SET);
            FooWithMap toFooWithMap = r.copy(fooMap);
            Map<Object, Object> toMap = toFooWithMap.getMap();
            assertNull(toMap);
        }
        {
            Hibernate5BeanReplicator r = new Hibernate5BeanReplicator();
            r.getHibernatePropertyFilter().withVetoer(new PropertyFilter() {