com.github.mustachejava.util.CapturingMustacheVisitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compiler Show documentation
Show all versions of compiler Show documentation
Implementation of mustache.js for Java
package com.github.mustachejava.util;
import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.DefaultMustacheVisitor;
import com.github.mustachejava.Mustache;
import com.github.mustachejava.TemplateContext;
import com.github.mustachejava.codes.IterableCode;
import com.github.mustachejava.codes.NotIterableCode;
import com.github.mustachejava.codes.ValueCode;
import java.io.Writer;
import java.util.List;
/**
* Grab a map of values returned from calls
*/
public class CapturingMustacheVisitor extends DefaultMustacheVisitor {
private final Captured captured;
public interface Captured {
void value(String name, String value);
void arrayStart(String name);
void arrayEnd();
void objectStart();
void objectEnd();
}
public CapturingMustacheVisitor(DefaultMustacheFactory cf, Captured captured) {
super(cf);
this.captured = captured;
}
@Override
public void value(TemplateContext tc, String variable, boolean encoded) {
list.add(new ValueCode(tc, df, variable, encoded) {
@Override
public Object get(List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy