public void toConfig(StringBuilder cfg, String prefix) {
        cfg.append(prefix).append("protocol ").append(RoutingSpec.toConfigString(protocol)).append("\n");
        int numHops = hops.size();
        if (numHops > 0) {
            cfg.append(prefix).append("hop[").append(numHops).append("]\n");
            for (int i = 0; i < numHops; ++i) {
                hops.get(i).toConfig(cfg, prefix + "hop[" + i + "].");
            }
        }
        int numRoutes = routes.size();
        if (numRoutes > 0) {
            cfg.append(prefix).append("route[").append(numRoutes).append("]\n");
            for (int i = 0; i < numRoutes; ++i) {
                routes.get(i).toConfig(cfg, prefix + "route[" + i + "].");
            }
        }
    }
Appends the content of this to the given config string builder.

@param cfg    The config to add to.
@param prefix The prefix to use for each add.
messagebus/src/main/java/com/yahoo/messagebus/routing/RoutingTableSpec.java