Package com.google.template.soy.javasrc.restricted

Examples of com.google.template.soy.javasrc.restricted.SoyJavaSrcPrintDirective


    // Process directives.
    for (PrintDirectiveNode directiveNode : node.getChildren()) {

      // Get directive.
      SoyJavaSrcPrintDirective directive = soyJavaSrcDirectivesMap.get(directiveNode.getName());
      if (directive == null) {
        throw SoySyntaxExceptionUtils.createWithNode(
            "Failed to find SoyJavaSrcPrintDirective with name '" + directiveNode.getName() + "'" +
                " (tag " + node.toSourceString() + ")",
            directiveNode);
      }

      // Get directive args.
      List<ExprRootNode<?>> args = directiveNode.getArgs();
      if (! directive.getValidArgsSizes().contains(args.size())) {
        throw SoySyntaxExceptionUtils.createWithNode(
            "Print directive '" + directiveNode.getName() + "' used with the wrong number of" +
                " arguments (tag " + node.toSourceString() + ").",
            directiveNode);
      }

      // Translate directive args.
      List<JavaExpr> argsJavaExprs = Lists.newArrayListWithCapacity(args.size());
      for (ExprRootNode<?> arg : args) {
        argsJavaExprs.add(ttjev.exec(arg));
      }

      // Apply directive.
      javaExpr = directive.applyForJavaSrc(javaExpr, argsJavaExprs);
    }

    javaExprs.add(javaExpr);
  }
View Full Code Here

TOP

Related Classes of com.google.template.soy.javasrc.restricted.SoyJavaSrcPrintDirective

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.