public final class TemplateResolution extends Object
Result of the execution of a Template Resolver.
A TemplateResolution object is created by implementations of ITemplateResolver
when templates are resolved, and it contains not only the resource representing the resolved
template, but also the template mode to be used and the cache validity to be applied.
The fact that a Template Resolver returns a TemplateResolution
does not necessarily
mean that the resolved template resource exists. It might only be so if the template resolver
is configured to perform an existence check on the resource before returning a resolution
result (by means of calling ITemplateResource.exists()
), which might be configurable on
a per-ITemplateResolver
-implementation basis. Implementations might choose not to check
resource existance by default in order to avoid the possible performance impact of a double access
to the resource.
Objects of this class should not be considered thread-safe.
Note a class with this name existed since 1.0, but it was completely reimplemented in 3.0.0.
Constructor and Description |
---|
TemplateResolution(ITemplateResource templateResource,
boolean templateResourceExistenceVerified,
TemplateMode templateMode,
boolean useDecoupledLogic,
ICacheEntryValidity validity) |
TemplateResolution(ITemplateResource templateResource,
TemplateMode templateMode,
ICacheEntryValidity validity) |
Modifier and Type | Method and Description |
---|---|
TemplateMode |
getTemplateMode()
Returns the template mode to be applied to the template, as suggested by the
ITemplateResolver . |
ITemplateResource |
getTemplateResource()
Returns the template resource.
|
boolean |
getUseDecoupledLogic()
Returns whether the existence of decoupled logic (normally in a separate file) should be checked
for this template during parsing.
|
ICacheEntryValidity |
getValidity()
Returns the template resolution validity.
|
boolean |
isTemplateResourceExistenceVerified()
Returns whether the existence of the resource returned by the resolution mechanism has
been already verified to actually exist by the template resolver during resolution.
|
public TemplateResolution(ITemplateResource templateResource, TemplateMode templateMode, ICacheEntryValidity validity)
public TemplateResolution(ITemplateResource templateResource, boolean templateResourceExistenceVerified, TemplateMode templateMode, boolean useDecoupledLogic, ICacheEntryValidity validity)
public ITemplateResource getTemplateResource()
Returns the template resource.
Template resource instances are usually created by implementations of
ITemplateResolver
.
Note that, even if this resource object will never be null, the existence of the
resource object does not necessarily imply the existence of the resource itself unless
the template resolver was configured for calling ITemplateResource.exists()
upon
template resolution.
public TemplateMode getTemplateMode()
Returns the template mode to be applied to the template, as suggested by the
ITemplateResolver
.
Note that this template mode can be ignored if the template being resolved is configured to be executed with a specific template mode regardless of what the template resolver suggests.
public boolean isTemplateResourceExistenceVerified()
Returns whether the existence of the resource returned by the resolution mechanism has been already verified to actually exist by the template resolver during resolution.
This allows avoiding further checks in case the resource.exists() execution is costly.
Note a false here does not mean the resource does not exist, but simply that its existence was not verified (true) during resolution.
public boolean getUseDecoupledLogic()
Returns whether the existence of decoupled logic (normally in a separate file) should be checked for this template during parsing.
Note a true here does not mean that a decoupled logic resource has to necessarily exist for this template, only that its existence should be checked and used if it exists.
public ICacheEntryValidity getValidity()
Returns the template resolution validity.
This validity establishes whether the template can be included in the template cache, and also for how long its resolution will be considered valid.
When a cached template is not considered valid, its cache entry is discarded and it is resolved again.
Copyright © 2016 The THYMELEAF team. All rights reserved.