|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.thymeleaf.processor.attr.AbstractAttrProcessor
public abstract class AbstractAttrProcessor
Base convenience implementation of IAttrProcessor
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 attribute processors, allowing the developer only to override the methods that are really needed.
Constructor Summary | |
---|---|
AbstractAttrProcessor()
|
Method Summary | |
---|---|
int |
compareTo(IAttrProcessor o)
|
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. |
Set<Class<? extends IValueProcessor>> |
getValueProcessorDependencies()
Return this processor's dependencies. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.thymeleaf.processor.attr.IAttrProcessor |
---|
getAttributeApplicabilities, getPrecedence, process |
Constructor Detail |
---|
public AbstractAttrProcessor()
Method Detail |
---|
public Set<Class<? extends IValueProcessor>> getValueProcessorDependencies()
IAttrProcessor
Return this processor's dependencies.
The dependencies are the set of value processors (IValueProcessor
objects) this attribute processor needs for being executed. This has to be declared
for dialect validation purposes at configuration time.
getValueProcessorDependencies
in interface IAttrProcessor
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 Spring Thymeleaf 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 attribute 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
public int compareTo(IAttrProcessor o)
compareTo
in interface Comparable<IAttrProcessor>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |