Class DirectoryCodeResolver
java.lang.Object
gg.jte.resolve.DirectoryCodeResolver
- All Implemented Interfaces:
CodeResolver
Resolves template code within a given root directory.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a template with this name exists.longgetLastModified(String name) Resolves the last modification time of a template.private longgetLastModified(Path file) getRoot()Resolves the code of a template.Resolves all template names thisCodeResolvercan resolve.resolveRequired(String name) Resolves the code of a template, which is required to exist.
-
Field Details
-
root
-
-
Constructor Details
-
DirectoryCodeResolver
-
-
Method Details
-
resolve
Description copied from interface:CodeResolverResolves the code of a template.- Specified by:
resolvein interfaceCodeResolver- Parameters:
name- The name of the template, e.g."tag/util/card.jte".- Returns:
- The code of the resolved template, or
nullif no template with this name exists.
-
resolveRequired
Description copied from interface:CodeResolverResolves the code of a template, which is required to exist.- Specified by:
resolveRequiredin interfaceCodeResolver- Parameters:
name- The name of the template, e.g."tag/util/card.jte".- Returns:
- The code of the resolved template, this is never
null. - Throws:
TemplateNotFoundException- if no template with this name exists. Implementations that have better knowledge why the loading failed, are expected to override this method and provide information about the problem in the thrown exception message.
-
exists
Description copied from interface:CodeResolverChecks if a template with this name exists.- Specified by:
existsin interfaceCodeResolver- Parameters:
name- The name of the template, e.g."tag/util/card.jte".- Returns:
trueif a template with this name exists, otherwise false.
-
getLastModified
Description copied from interface:CodeResolverResolves the last modification time of a template.- Specified by:
getLastModifiedin interfaceCodeResolver- Parameters:
name- The name of the template, e.g."tag/util/card.jte".- Returns:
- The last modification time of this template in milliseconds, or
0Lif no template with this name exists. In case thisCodeResolverdoes not support modification times0Lshould be returned.
-
getLastModified
-
resolveAllTemplateNames
Description copied from interface:CodeResolverResolves all template names thisCodeResolvercan resolve.- Specified by:
resolveAllTemplateNamesin interfaceCodeResolver- Returns:
- A list of all existing templates.
-
getRoot
-