]> WPIA git - gigi.git/blob - src/org/cacert/gigi/output/template/IfStatement.java
UPD: Move some template classes to there reightful place.
[gigi.git] / src / org / cacert / gigi / output / template / IfStatement.java
1 package org.cacert.gigi.output.template;
2
3 import java.io.PrintWriter;
4 import java.util.Map;
5
6 import org.cacert.gigi.localisation.Language;
7
8 public final class IfStatement implements Outputable {
9
10     private final String variable;
11
12     private final TemplateBlock body;
13
14     public IfStatement(String variable, TemplateBlock body) {
15         this.variable = variable;
16         this.body = body;
17     }
18
19     @Override
20     public void output(PrintWriter out, Language l, Map<String, Object> vars) {
21         Object o = vars.get(variable);
22         if ( !(o == Boolean.FALSE || o == null)) {
23             body.output(out, l, vars);
24         }
25     }
26 }