code: private void appendPopulateMethod(List<CStructDescriptor> messages) {
          writer.formatln("public static final %s populateConfig(%s %s, int %s) {",
                          Config.class.getName(),
                          Config.class.getName(),
                          CONFIG,
                          PORTABLE_VERSION)
                .begin()
                .formatln("%s %s = new %s();", FACTORY_IMPL, INSTANCE, FACTORY_IMPL)
                .formatln("%s.getSerializationConfig().addPortableFactory(%s, %s);", CONFIG, FACTORY_ID, INSTANCE)
                .formatln("%s.getSerializationConfig().setPortableVersion(%s);", CONFIG, PORTABLE_VERSION)
                .appendln()
                .formatln("%s.getSerializationConfig()", CONFIG)
                .begin()
                .begin();
          for (CStructDescriptor struct : messages) {
              writer.formatln(".addClassDefinition(%s.%s(%s))",
                              INSTANCE,
                              camelCase("get", struct.getName() + "Definition"),
                              PORTABLE_VERSION);
          }
          writer.append(";")
                .end()
                .end()
                .formatln("return %s;", CONFIG)
                .end()
                .appendln("}")
                .newline();
      }
docs: Method to append populate methods for the Hazelcast Config.
  
  @param messages List with CStructDescriptor to iterate through.
  <pre>
  {@code
  public static final com.hazelcast.config.Config populateConfig(com.hazelcast.config.Config config) {
  PortableFactoryImpl instance = new PortableFactoryImpl();
  config.getSerializationConfig().addPortableFactory(FACTORY_ID, instance);
  ...
  return config;
  }
  }
  </pre>