public void setProperty(String name, Object property) { context.put(name, property); }
private void iterateIterable(ExpressionContext context, TagNode tag, Writer out, Iterable<Object> o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); Iterator<?> it = o.iterator(); while (it.hasNext()) { Object o1 = it.next(); if (!it.hasNext()) { iter.setLast(); } context.put(getCurrentObjectName(), o1); tag.execute(context, out); iter.next(); } }
private void iterateInt(ExpressionContext context, TagNode tag, Writer out, int[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
bindings.put(Expressions.PARENT_OBJECT, s); bindings.put(Expressions.CURRENT_OBJECT, form); super.execute(bindings, out); bindings.put(Expressions.CURRENT_OBJECT, s.get()); bindings.put(Expressions.PARENT_OBJECT, s.getSuper()); bindings.put(Expressions.ITER_OBJECT, s.getIter()); } else { bindings.put(Expressions.CURRENT_OBJECT, t); bindings.put(Expressions.PARENT_OBJECT, ts); bindings.put(Expressions.ITER_OBJECT, iter);
private void iterateArray(ExpressionContext context, TagNode tag, Writer out, Object[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
context.put("___DebugAllValues___", elements); for (Fragment f : debugTemplate)
private void iterateDouble(ExpressionContext context, TagNode tag, Writer out, double[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
private void iterateChar(ExpressionContext context, TagNode tag, Writer out, char[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
private void iterateBoolean(ExpressionContext context, TagNode tag, Writer out, boolean[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
private void iterateFloat(ExpressionContext context, TagNode tag, Writer out, float[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
private void iterateByte(ExpressionContext context, TagNode tag, Writer out, byte[] o) throws IOException, TemplateEvaluationException { Iter iter = new Iter(); context.put(getIterObjectName(), iter); for (int i=0; i<o.length; i++) { if (i == o.length-1) iter.setLast(); context.put(getCurrentObjectName(), o[i]); tag.execute(context, out); iter.next(); } }
public final void execute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException { Object t = context.get(getCurrentObjectName()); Super ts = (Super) context.get(getParentObjectName()); Iter iter = (Iter) context.get(getIterObjectName()); Super s = null; if (t != null) { s = new Super(t, ts, iter); context.put(getParentObjectName(), s); } doExecute(context, tag, out); if (t != null) { context.put(getCurrentObjectName(), s.get()); context.put(getParentObjectName(), s.getSuper()); context.put(getIterObjectName(), s.getIter()); } else { context.put(getCurrentObjectName(), t); context.put(getParentObjectName(), ts); context.put(getIterObjectName(), iter); } }
public void eval(ExpressionContext context, Writer out) throws IOException, TemplateEvaluationException { try { context.put(varName, expression.eval(context)); } catch (ExpressionEvaluationException e) { throw new TemplateEvaluationException(e, "Could not execute the expression: " + expression.toString() + " on line: " + getBeginLine() + ", column: " + getBeginColumn(), getBeginLine(), getBeginColumn()); } }
@Override public void doExecute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException { try { Iter iter = new Iter(); for (int i = from.asInt(context); i <= to.asInt(context); i++) { if (i == to.asInt(context)) iter.setLast(); context.put(Expressions.CURRENT_OBJECT, i); context.put(Expressions.ITER_OBJECT, iter); tag.execute(context, out); iter.next(); } } catch (ExpressionEvaluationException e) { throw new TemplateEvaluationException(e, "Could not execute the expression: " + e.getMessage() + ", on line: " + tag.getBeginLine() + ", column: " + tag.getBeginColumn(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName()); } }
@Override public void doExecute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException { try { Iter iter = new Iter(); int n = number.asInt(context); for (int i = 0; i != n; i++) { if (i == n - 1) { iter.setLast(); } context.put(Expressions.CURRENT_OBJECT, i); context.put(Expressions.ITER_OBJECT, iter); tag.execute(context, out); iter.next(); } } catch (ExpressionEvaluationException e) { throw new TemplateEvaluationException(e, "Could not execute the expression: " + e.getMessage() + ", on line: " + tag.getBeginLine() + ", column: " + tag.getBeginColumn(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName()); } }
@Override protected void doExecute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException { try { context.put(getCurrentObjectName(), expression.eval(context)); tag.execute(context, out); } catch (ExpressionEvaluationException e) { throw new TemplateEvaluationException(e, "Could not execute the expression: " + e.getMessage() + ", on line: " + tag.getBeginLine() + ", column: " + tag.getBeginColumn(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName()); } }
@Override public void doExecute(ExpressionContext context, TagNode tag, Writer out) throws TemplateEvaluationException, IOException { try { Iter iter = new Iter(); while (expression.asBoolean(context)) { context.put(Expressions.ITER_OBJECT, iter); tag.execute(context, out); iter.next(); } } catch (ExpressionEvaluationException e) { throw new TemplateEvaluationException(e, "Could not execute the expression: " + e.getMessage() + ", on line: " + tag.getBeginLine() + ", column: " + tag.getBeginColumn(), tag.getBeginLine(), tag.getBeginColumn(), tag.getTagName()); } }