Examples of IfToken


Examples of com.floreysoft.jmte.token.IfToken

            // OUTER_PRFIX
            buffer.append("OUTER_PRFIX");

            // ${if item}
            IfToken token3 = new IfToken("item", false);
            context.push(token3);
            try {
              if ((Boolean) token3.evaluate(context)) {

                // ${item2.property1}
                buffer.append(new StringToken(Arrays
                    .asList(new String[] { "item2",
                        "property1" }),
View Full Code Here

Examples of com.floreysoft.jmte.token.IfToken

      context.pop();
    }
  }

  private void condition(boolean inheritedSkip) {
    IfToken ifToken = (IfToken) tokenStream.currentToken();
    tokenStream.consume();

    context.push(ifToken);
    try {
      boolean localSkip;
      if (inheritedSkip) {
        localSkip = true;
      } else {
        localSkip = !(Boolean) ifToken.evaluate(context);
      }

      Token contentToken;
      while ((contentToken = tokenStream.currentToken()) != null
          && !(contentToken instanceof EndToken)
View Full Code Here

Examples of com.floreysoft.jmte.token.IfToken

    localVarStack.remove(0);
  }

  private void condition() {
    IfToken ifToken = (IfToken) tokenStream.currentToken();
    tokenStream.consume();

    Label tryEndLabel = new Label();
    Label finalLabel = new Label();
    Label elseLabel = new Label();

    codeGenerateIfBlockStart(ifToken, tryEndLabel, elseLabel);

    String variableName = ifToken.getExpression();
    addUsedVariableIfNotLocal(variableName);
    Token contentToken;

    codeGenerateIfBranchStart();
    while ((contentToken = tokenStream.currentToken()) != null
View Full Code Here

Examples of com.floreysoft.jmte.token.IfToken

   */
  public boolean variablesAvailable(Map<String, Object> model, String... vars) {
    final TemplateContext context = new TemplateContext(null, null, null, new ScopedMap(model), modelAdaptor, this,
        new SilentErrorHandler(), null);
    for (String var : vars) {
      final IfToken token = new IfToken(var, false);
      if (!(Boolean) token.evaluate(context)) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

Examples of com.floreysoft.jmte.token.IfToken

  @Override
  protected String transformCompiled(TemplateContext context) {
    StringBuilder buffer = new StringBuilder();

    IfToken token1 = new IfToken(Arrays.asList(new String[] { "bean",
        "trueCond" }), "bean.trueCond", true);

    context.push(token1);
    try {
      if ((Boolean) token1.evaluate(context)) {
        buffer.append(new StringToken("address", "address", null, null,
            null, null, null).evaluate(context));
      } else {
        buffer.append("NIX");
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.