package org.sboehm.gbf.common;

import java.util.Collection;
import java.util.function.Function;

public abstract class AbstractMapper<BO extends BusinessObject, TO extends TransferObject> implements Mapper<BO, TO> {

    protected <PBO, PTO> void mapSomeProperties(Collection<PBO> propertiesFromBusinessObject, Collection<PTO> propertiesFromTransferObject, Function<PBO, PTO> propertyMapper) {
        propertiesFromBusinessObject //
                .stream() //
                .map(propertyMapper) //
                .forEach(propertiesFromTransferObject::add);
    }

}