Package com.lowtuna.jsonblob.config.view

Source Code of com.lowtuna.jsonblob.config.view.ProdHandlebarsConfig

package com.lowtuna.jsonblob.config.view;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.io.ClassPathTemplateLoader;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.NotEmpty;

@Data
@NoArgsConstructor
public class ProdHandlebarsConfig extends HandlebarsConfig {

    @NotEmpty
    @JsonProperty
    private String classPathTemplatesBaseDir = "/views";

    @Override
    @JsonIgnore
    public Handlebars createInstance() {
        return new Handlebars().with(new ClassPathTemplateLoader(classPathTemplatesBaseDir, StringUtils.EMPTY));
    }

}
TOP

Related Classes of com.lowtuna.jsonblob.config.view.ProdHandlebarsConfig

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.