public class TemplateNotification extends AbstractNotification implements Part
Template-based implementation of a Notification.CREATED_TIME_SORTER, LAST_UPDATED_TIME_SORTER| Constructor and Description |
|---|
TemplateNotification(String id,
long creationTime,
long lastUpdatedTime,
boolean dismissable,
Template template)
Creates a new notification.
|
TemplateNotification(String id,
Template template)
Creates a new notification.
|
TemplateNotification(Template template)
Creates a new notification.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
get(String name)
Returns the template variable with the given name.
|
protected Template |
getTemplate()
Expose the used template to subclasses.
|
TemplateContext |
getTemplateContext()
Returns the template that renders this notification.
|
void |
render(TemplateContext templateContext,
Writer writer)
Renders this part.
|
void |
render(Writer writer)
Renders this notification to the given writer.
|
TemplateNotification |
set(String name,
Object value)
Sets a template variable.
|
addNotificationListener, dismiss, equals, getCreatedTime, getId, getLastUpdatedTime, hashCode, isDismissable, removeNotificationListener, setDismissable, setLastUpdateTime, touchpublic TemplateNotification(Template template)
template - The template to renderpublic TemplateNotification(String id, Template template)
id - The ID of the notificationtemplate - The template to renderpublic TemplateNotification(String id, long creationTime, long lastUpdatedTime, boolean dismissable, Template template)
id - The ID of the notificationcreationTime - The creation time of the notificationlastUpdatedTime - The time the notification was last udpateddismissable - true if this notification is dismissable by the usertemplate - The template to renderpublic TemplateContext getTemplateContext()
protected Template getTemplate()
public TemplateNotification set(String name, Object value)
name - The name of the template variablevalue - The value of the template variablepublic Object get(String name)
TemplateContext.get(String) and will use
Accessors, Filters, and Plugins registered with
the notification’s template.name - The name of the template variablepublic void render(Writer writer) throws IOException
render in interface Renderablerender in interface Notificationwriter - The writer to render this notification toIOException - if an I/O error occurspublic void render(TemplateContext templateContext, Writer writer) throws TemplateException
render in interface ParttemplateContext - The template context for the partwriter - The writer to render the part toTemplateException - if a template variable can not be parsedCopyright © 2026. All rights reserved.