Class ResourceCodeResolver

java.lang.Object
gg.jte.resolve.ResourceCodeResolver
All Implemented Interfaces:
CodeResolver

public class ResourceCodeResolver extends Object implements CodeResolver
Resolves template code within a given resources root.
  • Field Details

    • root

      private final String root
    • classLoader

      private final ClassLoader classLoader
  • Constructor Details

    • ResourceCodeResolver

      public ResourceCodeResolver(String root)
    • ResourceCodeResolver

      public ResourceCodeResolver(String root, ClassLoader classLoader)
  • Method Details

    • resolve

      public String resolve(String name)
      Description copied from interface: CodeResolver
      Resolves the code of a template.
      Specified by:
      resolve in interface CodeResolver
      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.
    • exists

      public boolean exists(String name)
      Description copied from interface: CodeResolver
      Checks if a template with this name exists.
      Specified by:
      exists in interface CodeResolver
      Parameters:
      name - The name of the template, e.g. "tag/util/card.jte".
      Returns:
      true if a template with this name exists, otherwise false.
    • getLastModified

      public long getLastModified(String name)
      Description copied from interface: CodeResolver
      Resolves the last modification time of a template.
      Specified by:
      getLastModified in interface CodeResolver
      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.
    • getClassLoader

      private ClassLoader getClassLoader()