Module io.jstach.jstachio
Package io.jstach.jstachio.spi
Interface JStachioTemplateFinder.SimpleTemplateFinder
- All Superinterfaces:
JStachioExtension
,JStachioTemplateFinder
- All Known Subinterfaces:
TemplateProvider.GeneratedTemplateProvider
- Enclosing interface:
- JStachioTemplateFinder
An easier to implement template finder based on a sequence of templates.
- Author:
- agentgt
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jstach.jstachio.spi.JStachioTemplateFinder
JStachioTemplateFinder.SimpleTemplateFinder
-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable TemplateInfo
findOrNull
(Class<?> modelType) Finds a template or null if no template is found.default TemplateInfo
findTemplate
(Class<?> modelType) Finds aTemplate
if possible otherwise possibly falling back to aTemplateInfo
based on annotation metadata or some other mechanism.default boolean
supportsType
(Class<?> modelType) Determines if this template finder has a template for the model type (the class annotated by JStache).Iterable<? extends TemplateInfo>
Sequence of templates used to find matching template from model.Methods inherited from interface io.jstach.jstachio.spi.JStachioTemplateFinder
order
-
Method Details
-
findTemplate
Description copied from interface:JStachioTemplateFinder
Finds aTemplate
if possible otherwise possibly falling back to aTemplateInfo
based on annotation metadata or some other mechanism.- Specified by:
findTemplate
in interfaceJStachioTemplateFinder
- Parameters:
modelType
- the models class (the one annotated withJStache
and not the Templates class)- Returns:
- the template info which might be a
Template
if the generated template was found. - Throws:
Exception
- if any reflection or runtime error happensNoSuchElementException
- if the template is not found and there were no other errorsNullPointerException
- if the modelType is null
-
supportsType
Description copied from interface:JStachioTemplateFinder
Determines if this template finder has a template for the model type (the class annotated by JStache).- Specified by:
supportsType
in interfaceJStachioTemplateFinder
- Parameters:
modelType
- the models class (the one annotated withJStache
and not the Templates class)- Returns:
- true if this finder has template for modelType
-
findOrNull
Description copied from interface:JStachioTemplateFinder
Finds a template or null if no template is found. Should not throw an exception if a template is not found.- Specified by:
findOrNull
in interfaceJStachioTemplateFinder
- Parameters:
modelType
- the models class (the one annotated withJStache
and not the Templates class)- Returns:
null
if the template is was not found or the template info which might be aTemplate
if the generated template was found.- See Also:
-
templates
Iterable<? extends TemplateInfo> templates()Sequence of templates used to find matching template from model.- Returns:
- templates
-