|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.thymeleaf.processor.tag.AbstractTagProcessor
public abstract class AbstractTagProcessor
Base convenience implementation of ITagProcessor
returning empty
sets for all of the interface's methods and allowing easy access to internationalization
features by providing methods for obtaining both template messages and
processor messages.
This class provides a more convenient extension point for tag processors, allowing the developer only to override the methods that are really needed.
Constructor Summary | |
---|---|
AbstractTagProcessor()
|
Method Summary | |
---|---|
protected String |
getMessage(Arguments arguments,
TemplateResolution templateResolution,
String messageKey,
Object[] messageParameters)
Resolves a message, trying to resolve it first as a template message (see getMessageForTemplate(Arguments, TemplateResolution, String, Object[]) ) and,
if not found, as a processor message (see getMessageForProcessor(Arguments, String, Object[]) . |
protected String |
getMessageForProcessor(Arguments arguments,
String messageKey,
Object[] messageParameters)
Resolves the specified message as a processor message. |
protected String |
getMessageForTemplate(Arguments arguments,
TemplateResolution templateResolution,
String messageKey,
Object[] messageParameters)
Resolves the specified message as a template message. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.thymeleaf.processor.tag.ITagProcessor |
---|
getTagApplicabilities, process |
Constructor Detail |
---|
public AbstractTagProcessor()
Method Detail |
---|
protected String getMessage(Arguments arguments, TemplateResolution templateResolution, String messageKey, Object[] messageParameters)
Resolves a message, trying to resolve it first as a template message
(see getMessageForTemplate(Arguments, TemplateResolution, String, Object[])
) and,
if not found, as a processor message (see getMessageForProcessor(Arguments, String, Object[])
.
This method always returns a result: if no message is found for the specified key, a default placeholder message is returned (as a String).
arguments
- the execution arguments, containing Template Engine configuration and
execution context.templateResolution
- the result of resolving the template by the Template Resolvers.messageKey
- the message keymessageParameters
- the (optional) message parameters
protected String getMessageForTemplate(Arguments arguments, TemplateResolution templateResolution, String messageKey, Object[] messageParameters)
Resolves the specified message as a template message.
Template messages are resolved by the Message Resolver
(IMessageResolver
) instances
configured at the Template Engine (executed in chain) in exactly the same way as,
for example, a #{...} expression would when using the Standard
Dialect or the SpringStandard Dialect.
This method always returns a result: if no message is found for the specified key, a default placeholder message is returned (as a String).
arguments
- the execution arguments, containing Template Engine configuration and
execution context.templateResolution
- the result of resolving the template by the Template Resolvers.messageKey
- the message keymessageParameters
- the (optional) message parameters
protected String getMessageForProcessor(Arguments arguments, String messageKey, Object[] messageParameters)
Resolves the specified message as a processor message.
Processor messages appear on .properties files that usually live in the same package (i.e. source folder) as the processor class itself, and have the same base name (for example, for a com.something.MyProc processor we can have com/something/MyProc_en.properties, com/something/MyProc_es.properties, com/something/MyProc.properties (for defaults), etc.). This allows the encapsulation and packing of processors along with all of its required internationalization resources.
If no message is found for the specified key in a .properties file with the same base name as the tag processor, then its superclasses are also examined.
This method always returns a result: if at the end no message is found for the specified key, a default placeholder message is returned (as a String).
arguments
- the execution arguments, containing Template Engine configuration and
execution context.messageKey
- the message keymessageParameters
- the (optional) message parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |