code: private void generateTemplateMetadata() {
      SanitizedContentKind contentKind = templateNode.getContentKind();
      String kind = contentKind == null ? "" : contentKind.name();
  
      // using linked hash sets below for determinism
      Set<String> uniqueIjs = new LinkedHashSet<>();
      for (VarRefNode var : getAllNodesOfType(templateNode, VarRefNode.class)) {
        if (var.isInjected()) {
          uniqueIjs.add(var.getName());
        }
      }
  
      Set<String> callees = new LinkedHashSet<>();
      for (CallBasicNode call : getAllNodesOfType(templateNode, CallBasicNode.class)) {
        callees.add(call.getCalleeName());
      }
  
      Set<String> delCallees = new LinkedHashSet<>();
      for (CallDelegateNode call : getAllNodesOfType(templateNode, CallDelegateNode.class)) {
        delCallees.add(call.getDelCalleeName());
      }
  
      TemplateMetadata.DelTemplateMetadata deltemplateMetadata;
      if (templateNode.getKind() == SoyNode.Kind.TEMPLATE_DELEGATE_NODE) {
        TemplateDelegateNode delegateNode = (TemplateDelegateNode) templateNode;
        deltemplateMetadata =
            createDelTemplateMetadata(
                delegateNode.getDelPackageName() == null ? "" : delegateNode.getDelPackageName(),
                delegateNode.getDelTemplateName(),
                delegateNode.getDelTemplateVariant());
      } else {
        deltemplateMetadata = createDefaultDelTemplateMetadata();
      }
      TemplateMetadata metadata =
          createTemplateMetadata(kind, uniqueIjs, callees, delCallees, deltemplateMetadata);
      TEMPLATE_METADATA_REF.write(metadata, writer);
    }
docs: Writes a {@link TemplateMetadata} to the generated class.