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

play.template2.GTTemplateInstanceFactory Maven / Gradle / Ivy

package play.template2;

import play.template2.exceptions.GTException;

public abstract class GTTemplateInstanceFactory {

    public GTJavaBase create(GTTemplateRepo templateRepo) {
        try {
            GTJavaBase templateInstance = getTemplateClass().getDeclaredConstructor().newInstance();
            // Must tell the template Instance where the current templateRepo is - needed when processing #{extends} and custom tags
            templateInstance.templateRepo = templateRepo;
            return templateInstance;
        } catch (Exception e) {
            throw new GTException("Error creating template instance", e);
        }
    }

    public abstract Class getTemplateClass();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy