io.swagger.codegen.v3.generators.handlebars.NotEmptyHelper Maven / Gradle / Ivy
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