Search in sources :

Example 1 with TemplateModelAdapter

use of freemarker.template.TemplateModelAdapter in project freemarker by apache.

the class ModelCache method getInstance.

public TemplateModel getInstance(Object object) {
    if (object instanceof TemplateModel) {
        return (TemplateModel) object;
    }
    if (object instanceof TemplateModelAdapter) {
        return ((TemplateModelAdapter) object).getTemplateModel();
    }
    if (useCache && isCacheable(object)) {
        TemplateModel model = lookup(object);
        if (model == null) {
            model = create(object);
            register(model, object);
        }
        return model;
    } else {
        return create(object);
    }
}
Also used : TemplateModel(freemarker.template.TemplateModel) TemplateModelAdapter(freemarker.template.TemplateModelAdapter)

Aggregations

TemplateModel (freemarker.template.TemplateModel)1 TemplateModelAdapter (freemarker.template.TemplateModelAdapter)1