Package gg.jte

Interface CodeResolver


  • public interface CodeResolver
    Responsible for resolving template code. Used by the TemplateEngine to transfer templates into native Java/Kotlin code. When running in production with precompiled templates, no CodeResolver is required.
    • Method Detail

      • resolve

        java.lang.String resolve​(java.lang.String name)
        Resolves the code of a template.
        Parameters:
        name - The name of the template, e.g. "tag/util/card.jte".
        Returns:
        The code of the resolved template, or null if no template with this name exists.
      • getLastModified

        long getLastModified​(java.lang.String name)
        Resolves the last modification time of a template.
        Parameters:
        name - The name of the template, e.g. "tag/util/card.jte".
        Returns:
        The last modification time of this template in milliseconds, or 0L if no template with this name exists. In case this CodeResolver does not support modification times 0L should be returned.
      • resolveAllTemplateNames

        default java.util.List<java.lang.String> resolveAllTemplateNames()
        Resolves all template names this CodeResolver can resolve.
        Returns:
        A list of all existing templates.
        Throws:
        java.lang.UnsupportedOperationException - in case this operation is not supported by this code resolver
      • exists

        default boolean exists​(java.lang.String name)
        Checks if a template with this name exists.
        Parameters:
        name - The name of the template, e.g. "tag/util/card.jte".
        Returns:
        true if a template with this name exists, otherwise false.