Interface TemplateClassResolver

  • All Known Implementing Classes:
    OptInTemplateClassResolver

    public interface TemplateClassResolver
    Used by built-ins and other template language features that get a class based on a string. This can be handy both for implementing security restrictions and for working around local class-loader issues. The implementation should be thread-safe, unless an instance is always only used in a single Environment object.
    Since:
    2.3.17
    See Also:
    Configurable.setNewBuiltinClassResolver(TemplateClassResolver)
    • Method Detail

      • resolve

        java.lang.Class resolve​(java.lang.String className,
                                Environment env,
                                Template template)
                         throws TemplateException
        Gets a Class based on the class name.
        Parameters:
        className - the full-qualified class name
        env - the environment in which the template executes
        template - the template where the operation that require the class resolution resides in. This is null if the call doesn't come from a template.
        Throws:
        TemplateException - if the class can't be found or shouldn't be accessed from a template for security reasons.