// Path: dalesbred/src/main/java/org/dalesbred/internal/utils/Throwables.java
// public final class Throwables {
// 
//     private Throwables() { }
// 
//     public static @NotNull RuntimeException propagate(@NotNull Throwable e) {
//         if (e instanceof Error)
//             throw (Error) e;
//         else if (e instanceof RuntimeException)
//             return (RuntimeException) e;
//         else
//             return new WrappedCheckedException(e);
//     }
// 
//     public static @NotNull <T extends Exception> T propagate(@NotNull Throwable e, @NotNull Class<T> allowed) {
//         if (allowed.isInstance(e))
//             return allowed.cast(e);
//         else
//             throw propagate(e);
//     }
// }


import static java.util.Objects.requireNonNull;
import org.dalesbred.internal.utils.Throwables;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.List;

    ReflectionInstantiator(@NotNull Executable instantiator,
                           @NotNull List<TypeConversion> conversions,
                           @NotNull List<PropertyAccessor> accessors) {
        this.instantiator = requireNonNull(instantiator);
        this.conversions = requireNonNull(conversions);
        this.accessors = requireNonNull(accessors);
        this.parameterCount = instantiator.getParameterTypes().length;
    }


    @Override
    public @NotNull T instantiate(@NotNull InstantiatorArguments arguments) {
        try {
            Object[] argumentArray = toArgumentArray(arguments.getValues());

            Object v;
            if (instantiator instanceof Constructor<?>) {
                v = ((Constructor<?>) instantiator).newInstance(argumentArray);
            } else if (instantiator instanceof  Method) {
                v = ((Method) instantiator).invoke(null, argumentArray);
            } else {
                throw new IllegalStateException("Unexpected instantiator: " + instantiator);
            }

            @SuppressWarnings("unchecked")
            T value = (T) v;
            bindRemainingProperties(value, arguments);
            return value;
        } catch (Exception e) {
// Path: dalesbred/src/main/java/org/dalesbred/internal/utils/Throwables.java
// public final class Throwables {
// 
//     private Throwables() { }
// 
//     public static @NotNull RuntimeException propagate(@NotNull Throwable e) {
//         if (e instanceof Error)
//             throw (Error) e;
//         else if (e instanceof RuntimeException)
//             return (RuntimeException) e;
//         else
//             return new WrappedCheckedException(e);
//     }
// 
//     public static @NotNull <T extends Exception> T propagate(@NotNull Throwable e, @NotNull Class<T> allowed) {
//         if (allowed.isInstance(e))
//             return allowed.cast(e);
//         else
//             throw propagate(e);
//     }
// }


// Path: dalesbred/src/main/java/org/dalesbred/internal/instantiation/ReflectionInstantiator.java
import static java.util.Objects.requireNonNull;
import org.dalesbred.internal.utils.Throwables;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.util.List;


    ReflectionInstantiator(@NotNull Executable instantiator,
                           @NotNull List<TypeConversion> conversions,
                           @NotNull List<PropertyAccessor> accessors) {
        this.instantiator = requireNonNull(instantiator);
        this.conversions = requireNonNull(conversions);
        this.accessors = requireNonNull(accessors);
        this.parameterCount = instantiator.getParameterTypes().length;
    }


    @Override
    public @NotNull T instantiate(@NotNull InstantiatorArguments arguments) {
        try {
            Object[] argumentArray = toArgumentArray(arguments.getValues());

            Object v;
            if (instantiator instanceof Constructor<?>) {
                v = ((Constructor<?>) instantiator).newInstance(argumentArray);
            } else if (instantiator instanceof  Method) {
                v = ((Method) instantiator).invoke(null, argumentArray);
            } else {
                throw new IllegalStateException("Unexpected instantiator: " + instantiator);
            }

            @SuppressWarnings("unchecked")
            T value = (T) v;
            bindRemainingProperties(value, arguments);
            return value;
        } catch (Exception e) {
            throw Throwables.propagate(e);