]> WPIA git - gigi.git/commitdiff
ADD: small template utility (Scope), not directly usable
authorFelix Dörre <felix@dogcraft.de>
Sat, 31 Jan 2015 23:44:03 +0000 (00:44 +0100)
committerFelix Dörre <felix@dogcraft.de>
Sat, 31 Jan 2015 23:44:03 +0000 (00:44 +0100)
src/org/cacert/gigi/output/template/Scope.java [new file with mode: 0644]

diff --git a/src/org/cacert/gigi/output/template/Scope.java b/src/org/cacert/gigi/output/template/Scope.java
new file mode 100644 (file)
index 0000000..9a15b3a
--- /dev/null
@@ -0,0 +1,28 @@
+package org.cacert.gigi.output.template;
+
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.cacert.gigi.localisation.Language;
+
+public class Scope implements Outputable {
+
+    private Map<String, Object> vars;
+
+    private Outputable out;
+
+    public Scope(Outputable out, Map<String, Object> vars) {
+        this.out = out;
+        this.vars = vars;
+    }
+
+    @Override
+    public void output(PrintWriter out, Language l, Map<String, Object> vars) {
+        HashMap<String, Object> map = new HashMap<>();
+        map.putAll(vars);
+        map.putAll(this.vars);
+        this.out.output(out, l, map);
+    }
+
+}