public <C> C instantiate(Class<C> c) {
        List<Constructor<?>> constructors = new ArrayList<Constructor<?>>();
        for (Constructor<?> constructor : c.getConstructors()) {
            constructors.add(constructor);
        }
        Collections.sort(constructors, ConstructorComparator.PARAMETER_COUNT);
        Constructor<?> constructor = constructors.get(0);
        try {
            return (C) constructor.newInstance(niceParamsFor(constructor));
        } catch (InstantiationException e) {
            throw new BeanInstantiationException("Couldn't instantiate class "+c.getName()+" using the "+constructor.getParameterTypes().length+"-argument constructor", e);
        } catch (IllegalAccessException e) {
            throw new BeanInstantiationException("Couldn't instantiate class "+c.getName()+" using the "+constructor.getParameterTypes().length+"-argument constructor", e);
        } catch (IllegalArgumentException e) {
            throw new BeanInstantiationException("Couldn't instantiate class "+c.getName()+" using the "+constructor.getParameterTypes().length+"-argument constructor", e);
        } catch (InvocationTargetException e) {
            throw new BeanInstantiationException("Couldn't instantiate class "+c.getName()+" using the "+constructor.getParameterTypes().length+"-argument constructor", e);
        }
    }