code: List<String> generateFactoryMethodsAndFields(String key, Message msg) {
          MessageInfo msgInfo = msg.getMessageInfo();
          List<MessageLine> lines = msg.getLines(false);
          String javadoc = lines.stream()
                  .filter(ml -> !ml.isInfo() && !ml.isEmptyOrComment())
                  .map(ml -> ml.text)
                  .collect(Collectors.joining("\n *"));
          String[] keyParts = key.split("\\.");
          FactoryKind k = FactoryKind.parseFrom(keyParts[1]);
          String factoryName = factoryName(key);
          if (msgInfo.getTypes().isEmpty()) {
              //generate field
              String factoryField = StubKind.FACTORY_FIELD.format(k.keyClazz, factoryName,
                      "\"" + keyParts[0] + "\"",
                      "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
                      javadoc);
              return Collections.singletonList(factoryField);
          } else {
              //generate method
              List<String> factoryMethods = new ArrayList<>();
              for (List<MessageType> msgTypes : normalizeTypes(0, msgInfo.getTypes())) {
                  List<String> types = generateTypes(msgTypes);
                  List<String> argNames = argNames(types.size());
                  String suppressionString = needsSuppressWarnings(msgTypes) ?
                          StubKind.SUPPRESS_WARNINGS.format() : "";
                  String factoryMethod = StubKind.FACTORY_METHOD_DECL.format(suppressionString, k.keyClazz,
                          factoryName, argDecls(types, argNames).stream().collect(Collectors.joining(", ")),
                          indent(StubKind.FACTORY_METHOD_BODY.format(k.keyClazz,
                                  "\"" + keyParts[0] + "\"",
                                  "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
                                  argNames.stream().collect(Collectors.joining(", "))), 1),
                          javadoc);
                  factoryMethods.add(factoryMethod);
              }
              return factoryMethods;
          }
      }
docs: Generate a list of factory methods/fields to be added to a given factory nested class.