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

liqp.filters.First 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.filters;

import liqp.TemplateContext;

public class First extends Filter {

    /*
     * first(array)
     *
     * Get the first element of the passed in array
     */
    @Override
    public Object apply(Object value, TemplateContext context, Object... params) {

        Object[] array = super.asArray(value, context);

        return array.length == 0 ? null : array[0];
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy