PageRenderTime 36ms CodeModel.GetById 29ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/sitebricks/src/main/java/com/google/sitebricks/rendering/control/IncludeWidget.java

http://github.com/dhanji/sitebricks
Java | 30 lines | 21 code | 6 blank | 3 comment | 0 complexity | d57593be4250c783d2c541ee57edc2fb MD5 | raw file
 1package com.google.sitebricks.rendering.control;
 2
 3import com.google.sitebricks.Evaluator;
 4import com.google.sitebricks.Renderable;
 5import com.google.sitebricks.Respond;
 6
 7import java.util.Collections;
 8import java.util.Set;
 9
10/**
11 * @author Dhanji R. Prasanna (dhanji@gmail com)
12 */
13class IncludeWidget implements Renderable {
14    private final String name;
15    private final Evaluator evaluator;
16
17    public IncludeWidget(WidgetChain chain, String name, Evaluator evaluator) {
18        this.name = name;
19        this.evaluator = evaluator;
20    }
21
22    public void render(Object bound, Respond respond) {
23        respond.include((String) evaluator.evaluate(name, bound))
24                .render(bound, respond);
25    }
26
27    public <T extends Renderable> Set<T> collect(Class<T> clazz) {
28        return Collections.emptySet();
29    }
30}