// Path: src/main/java/org/echocat/gradle/plugins/golang/utils/BeanUtils.java
// public static <T> void copyNonNulls(@Nonnull Class<T> type, @Nonnull T from, @Nonnull T to) {
//     if (!type.isInstance(from)) {
//         throw new IllegalArgumentException("From is not an instance of " + type.getName() + ". Got: " + from);
//     }
//     if (!type.isInstance(to)) {
//         throw new IllegalArgumentException("To is not an instance of " + type.getName() + ". Got: " + to);
//     }
//     try {
//         final BeanInfo info = Introspector.getBeanInfo(type);
//         for (final PropertyDescriptor descriptor : info.getPropertyDescriptors()) {
//             final Method readMethod = descriptor.getReadMethod();
//             final Method writeMethod = descriptor.getWriteMethod();
//             if (readMethod != null && writeMethod != null) {
//                 final Object value = readMethod.invoke(from);
//                 if (value instanceof Map) {
//                     //noinspection unchecked
//                     final Map<Object, Object> properties = (Map<Object, Object>) readMethod.invoke(to);
//                     if (properties != null) {
//                         //noinspection unchecked
//                         properties.putAll((Map<Object, Object>) value);
//                     } else {
//                         writeMethod.invoke(to, value);
//                     }
//                 } else if (value != null) {
//                     writeMethod.invoke(to, value);
//                 }
//             }
//         }
//     } catch (final Exception e) {
//         throw new RuntimeException("Could not copy properties from " + from + " to " + to + ".", e);
//     }
// }


import org.gradle.api.Project;
import org.gradle.api.plugins.ExtensionAware;
import org.gradle.api.plugins.ExtensionContainer;
import javax.annotation.Nonnull;
import static org.echocat.gradle.plugins.golang.utils.BeanUtils.copyNonNulls;
    }

    @Nonnull
    public ToolchainSettings getToolchain() {
        return _toolchain;
    }

    @Nonnull
    public DependenciesSettings getDependencies() {
        return _dependencies;
    }

    @Nonnull
    public TestingSettings getTesting() {
        return _testing;
    }

    @Nonnull
    public Project getProject() {
        return _project;
    }

    @Nonnull
    public Settings merge(@Nonnull Settings... with) {
        final GolangSettings golang = new GolangSettings(false, _project);
        final BuildSettings build = new BuildSettings(false, _project);
        final ToolchainSettings toolchain = new ToolchainSettings(false, _project);
        final DependenciesSettings dependencies = new DependenciesSettings(false, _project);
        final TestingSettings testing = new TestingSettings(false, _project);

// Path: src/main/java/org/echocat/gradle/plugins/golang/utils/BeanUtils.java
// public static <T> void copyNonNulls(@Nonnull Class<T> type, @Nonnull T from, @Nonnull T to) {
//     if (!type.isInstance(from)) {
//         throw new IllegalArgumentException("From is not an instance of " + type.getName() + ". Got: " + from);
//     }
//     if (!type.isInstance(to)) {
//         throw new IllegalArgumentException("To is not an instance of " + type.getName() + ". Got: " + to);
//     }
//     try {
//         final BeanInfo info = Introspector.getBeanInfo(type);
//         for (final PropertyDescriptor descriptor : info.getPropertyDescriptors()) {
//             final Method readMethod = descriptor.getReadMethod();
//             final Method writeMethod = descriptor.getWriteMethod();
//             if (readMethod != null && writeMethod != null) {
//                 final Object value = readMethod.invoke(from);
//                 if (value instanceof Map) {
//                     //noinspection unchecked
//                     final Map<Object, Object> properties = (Map<Object, Object>) readMethod.invoke(to);
//                     if (properties != null) {
//                         //noinspection unchecked
//                         properties.putAll((Map<Object, Object>) value);
//                     } else {
//                         writeMethod.invoke(to, value);
//                     }
//                 } else if (value != null) {
//                     writeMethod.invoke(to, value);
//                 }
//             }
//         }
//     } catch (final Exception e) {
//         throw new RuntimeException("Could not copy properties from " + from + " to " + to + ".", e);
//     }
// }


// Path: src/main/java/org/echocat/gradle/plugins/golang/model/Settings.java
import org.gradle.api.Project;
import org.gradle.api.plugins.ExtensionAware;
import org.gradle.api.plugins.ExtensionContainer;
import javax.annotation.Nonnull;
import static org.echocat.gradle.plugins.golang.utils.BeanUtils.copyNonNulls;

    }

    @Nonnull
    public ToolchainSettings getToolchain() {
        return _toolchain;
    }

    @Nonnull
    public DependenciesSettings getDependencies() {
        return _dependencies;
    }

    @Nonnull
    public TestingSettings getTesting() {
        return _testing;
    }

    @Nonnull
    public Project getProject() {
        return _project;
    }

    @Nonnull
    public Settings merge(@Nonnull Settings... with) {
        final GolangSettings golang = new GolangSettings(false, _project);
        final BuildSettings build = new BuildSettings(false, _project);
        final ToolchainSettings toolchain = new ToolchainSettings(false, _project);
        final DependenciesSettings dependencies = new DependenciesSettings(false, _project);
        final TestingSettings testing = new TestingSettings(false, _project);

        copyNonNulls(GolangSettings.class, _golang, golang);