001package org.dcm4che3.conf.api.extensions;
002
003import org.dcm4che3.conf.core.api.internal.ConfigProperty;
004import org.dcm4che3.conf.core.api.internal.ConfigReflection;
005
006/**
007 *
008 * @author Roman K
009 */
010public class ReconfiguringIterator {
011    public static void reconfigure(Object source, Object target, Class configurableClass) {
012        for (ConfigProperty property : ConfigReflection.getAllConfigurableFields(configurableClass)) {
013            try {
014                ConfigReflection.setProperty(target, property, ConfigReflection.getProperty(source, property));
015            } catch (Exception e) {
016                throw new RuntimeException("Unable to reconfigure instance of class " + property.getRawClass(), e);
017            }
018        }
019    }
020}