class MimicCreator {

    public void mimicConstructors(CtClass src, CtClass dst) throws CannotCompileException, NotFoundException {
        for (final CtConstructor constructor : src.getDeclaredConstructors()) {
            log.fine("Mimic constructor " + constructor.getName());
            boolean destHasSameConstructor = false;
            for (CtConstructor constructorInDest : dst.getDeclaredConstructors()) {
                String signature = constructor.getSignature();
                String signatureInDest = constructorInDest.getSignature();
                if (signatureInDest.equals(signature)) {
                    destHasSameConstructor = true;
                    log.fine("Forwarding " + constructor.getName());
                    String key = this.key == null ? "" : (this.key + "_");
                    final String copiedConstructorName = "_copy_" + key + constructor.getName();
                    dst.addMethod(constructor.toMethod(copiedConstructorName, dst));
                    StringBuffer buffer = new StringBuffer();
                    for (int j = 0; j < constructor.getParameterTypes().length; j++) {
                        buffer.append(" $");
                        buffer.append(j + 1);
                        buffer.append(",");
                    }
                    String params = buffer.toString();
                    if (params.length() > 0) {
                        params = params.substring(0, params.length() - 1);
                    }
                    String string = copiedConstructorName + "(" + params + ");\n";
                    log.fine("Injected constructor " + string);
                    constructorInDest.insertAfter(string);
                }
            }
            if (!destHasSameConstructor) {
                log.fine("Copying " + constructor.getName());
                dst.addConstructor(CtNewConstructor.copy(constructor, dst, null));
            }
        }
    }

    public  MimicCreator();
    public  MimicCreator(String key);

}