All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liqp.nodes.OutputNode Maven / Gradle / Ivy

Go to download

A Java implementation of the Liquid templating engine backed up by an ANTLR grammar.

There is a newer version: 0.9.1.3
Show newest version
package liqp.nodes;

import liqp.TemplateContext;

import java.util.ArrayList;
import java.util.List;

class OutputNode implements LNode {

    private LNode expression;
    private List filters;

    public OutputNode(LNode expression) {
        this.expression = expression;
        this.filters = new ArrayList();
    }

    public void addFilter(FilterNode filter) {
        filters.add(filter);
    }

    @Override
    public Object render(TemplateContext context) {

        Object value = expression.render(context);

        for (FilterNode node : filters) {
            value = node.apply(value, context);
        }

        return value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy