public static TemplateMetadata fromTemplate(TemplateNode template) {
    TemplateMetadata.Builder builder =
        builder()
            .setTemplateName(template.getTemplateName())
            .setSourceLocation(template.getSourceLocation())
            .setSoyFileKind(SoyFileKind.SRC)
            .setContentKind(template.getContentKind())
            .setStrictHtml(template.isStrictHtml())
            .setDelPackageName(template.getDelPackageName())
            .setVisibility(template.getVisibility())
            .setParameters(Parameter.directParametersFromTemplate(template))
            .setDataAllCallSituations(DataAllCallSituation.fromTemplate(template));
    switch (template.getKind()) {
      case TEMPLATE_BASIC_NODE:
        builder.setTemplateKind(Kind.BASIC);
        break;
      case TEMPLATE_DELEGATE_NODE:
        builder.setTemplateKind(Kind.DELTEMPLATE);
        TemplateDelegateNode deltemplate = (TemplateDelegateNode) template;
        builder.setDelTemplateName(deltemplate.getDelTemplateName());
        builder.setDelTemplateVariant(deltemplate.getDelTemplateVariant());
        break;
      case TEMPLATE_ELEMENT_NODE:
        builder.setTemplateKind(Kind.ELEMENT);
        break;
      default:
        throw new AssertionError("unexpected template kind: " + template.getKind());
    }
    return builder.build();
  }
public static TemplateMetadata fromTemplate ( TemplateNode template ) { TemplateMetadata . Builder builder = builder ( ) . setTemplateName ( template . getTemplateName ( ) ) . setSourceLocation ( template . getSourceLocation ( ) ) . setSoyFileKind ( SoyFileKind . SRC ) . setContentKind ( template . getContentKind ( ) ) . setStrictHtml ( template . isStrictHtml ( ) ) . setDelPackageName ( template . getDelPackageName ( ) ) . setVisibility ( template . getVisibility ( ) ) . setParameters ( Parameter . directParametersFromTemplate ( template ) ) . setDataAllCallSituations ( DataAllCallSituation . fromTemplate ( template ) ) ; switch ( template . getKind ( ) ) { case TEMPLATE_BASIC_NODE : builder . setTemplateKind ( Kind . BASIC ) ; break ; case TEMPLATE_DELEGATE_NODE : builder . setTemplateKind ( Kind . DELTEMPLATE ) ; TemplateDelegateNode deltemplate = ( TemplateDelegateNode ) template ; builder . setDelTemplateName ( deltemplate . getDelTemplateName ( ) ) ; builder . setDelTemplateVariant ( deltemplate . getDelTemplateVariant ( ) ) ; break ; case TEMPLATE_ELEMENT_NODE : builder . setTemplateKind ( Kind . ELEMENT ) ; break ; default : throw new AssertionError ( "unexpected template kind: " + template . getKind ( ) ) ; } return builder . build ( ) ; }
Builds a Template from a parsed TemplateNode.