private static String assignFromBuilder(CNode child) {
        final String name = child.getName();
        final String className = nodeClass(child);
        final boolean isArray = child.isArray;
        final boolean isMap = child.isMap;

        if (child instanceof FileLeaf && isArray) {
            return name + " = LeafNodeVector.createFileNodeVector(builder." + name + ");";
        } else if (child instanceof PathLeaf && isArray) {
            return name + " = LeafNodeVector.createPathNodeVector(builder." + name + ");";
        } else if (child instanceof OptionalPathLeaf && isArray) {
            return name + " = LeafNodeVector.createOptionalPathNodeVector(builder." + name + ");";
        } else if (child instanceof UrlLeaf && isArray) {
            return name + " = LeafNodeVector.createUrlNodeVector(builder." + name + ");";
        } else if (child instanceof ModelLeaf && isArray) {
            return name + " = LeafNodeVector.createModelNodeVector(builder." + name + ");";
        } else if (child instanceof LeafCNode && isArray) {
            return name + " = new LeafNodeVector<>(builder." + name + ", new " + className + "());";
        } else if (child instanceof FileLeaf && isMap) {
            return name + " = LeafNodeMaps.asFileNodeMap(builder." + name + ");";
        } else if (child instanceof PathLeaf && isMap) {
            return name + " = LeafNodeMaps.asPathNodeMap(builder." + name + ");";
        } else if (child instanceof OptionalPathLeaf && isMap) {
            return name + " = LeafNodeMaps.asOptionalPathNodeMap(builder." + name + ");";
        } else if (child instanceof UrlLeaf && isMap) {
            return name + " = LeafNodeMaps.asUrlNodeMap(builder." + name + ");";
        } else if (child instanceof ModelLeaf && isMap) {
            return name + " = LeafNodeMaps.asModelNodeMap(builder." + name + ");";
        } else if (child instanceof LeafCNode && isMap) {
            return name + " = LeafNodeMaps.asNodeMap(builder." + name + ", new " + className + "());";
        } else if (child instanceof InnerCNode && isArray) {
            return name + " = " + className + ".createVector(builder." + name + ");";
        } else if (child instanceof InnerCNode && isMap) {
            return name + " = " + className + ".createMap(builder." + name + ");";
        } else if (child instanceof InnerCNode) {
            return name + " = new " + className + "(builder." + name + ", throwIfUninitialized);";
        } else if (child instanceof LeafCNode) {
            return name + " = (builder." + name + " == null) ?\n" +
                    "    new " + className + "(" + scalarDefault((LeafCNode) child) + ") : new " + className + "(builder." + name + ");";
        } else {
            throw new IllegalStateException("Cannot create assignment for node"); // should not happen
        }
    }
@author gjoranv
@author Tony Vaagenes
@author ollivir
configgen/src/main/java/com/yahoo/config/codegen/ConfigGenerator.java