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

io.swagger.codegen.v3.generators.handlebars.NotEmptyHelper Maven / Gradle / Ivy

There is a newer version: 1.0.55
Show newest version
package io.swagger.codegen.v3.generators.handlebars;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

import java.io.IOException;
import java.util.Collection;

public class NotEmptyHelper implements Helper {
    public static final String NAME = "notEmpty";

    @Override
    public Object apply(Collection collection, Options options) throws IOException {
        final Options.Buffer buffer = options.buffer();

        if (collection == null || collection.isEmpty()) {
            buffer.append(options.inverse());
        } else {
            buffer.append(options.fn());
        }
        return buffer;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy