Class TestEngineMessageResolver
- java.lang.Object
-
- org.thymeleaf.messageresolver.AbstractMessageResolver
-
- org.thymeleaf.testing.templateengine.engine.resolver.TestEngineMessageResolver
-
- All Implemented Interfaces:
IMessageResolver
public class TestEngineMessageResolver extends AbstractMessageResolver
-
-
Field Summary
Fields Modifier and Type Field Description private StandardMessageResolverstandardMessageResolver
-
Constructor Summary
Constructors Constructor Description TestEngineMessageResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcreateAbsentMessageRepresentation(ITemplateContext context, java.lang.Class<?> origin, java.lang.String key, java.lang.Object[] messageParameters)Create a suitable representation of an absent message (a message that could not be resolved).java.lang.StringresolveMessage(ITemplateContext context, java.lang.Class<?> origin, java.lang.String key, java.lang.Object[] messageParameters)Resolve the message, returning the requested message (ornullif not found).-
Methods inherited from class org.thymeleaf.messageresolver.AbstractMessageResolver
getName, getOrder, setName, setOrder
-
-
-
-
Field Detail
-
standardMessageResolver
private final StandardMessageResolver standardMessageResolver
-
-
Method Detail
-
resolveMessage
public java.lang.String resolveMessage(ITemplateContext context, java.lang.Class<?> origin, java.lang.String key, java.lang.Object[] messageParameters)
Description copied from interface:IMessageResolverResolve the message, returning the requested message (or
nullif not found).Message resolvers should perform resolution of the
key+messageParameterspair based on thecontextandoriginspecified. The context will provide information about the template and the (optional)originabout the point in template execution from which the message is being requested (usually anIProcessoror theMessageExpressionclass).- Parameters:
context- theITemplateContextobject being used for template processing. Can be null.origin- the origin of the message request, usually a processor or expression class. Can be null.key- the message key.messageParameters- the (optional) message parameters.- Returns:
- the resolved message, or
nullif the message could not be resolved.
-
createAbsentMessageRepresentation
public java.lang.String createAbsentMessageRepresentation(ITemplateContext context, java.lang.Class<?> origin, java.lang.String key, java.lang.Object[] messageParameters)
Description copied from interface:IMessageResolverCreate a suitable representation of an absent message (a message that could not be resolved).
Once the entire chain of configured
IMessageResolverobjects is asked for a specific message and all of them returnnull, the engine will call this method on the first resolver in the chain. If the first resolver returnsnullas a representation, the following resolver will be called, and so on until a resolver returns a non-null result. The empty String will be used if all resolvers return null.- Parameters:
context- theITemplateContextobject being used for template processing. Can be null.origin- the origin of the message request, usually a processor or expression class. Can be null.key- the message key.messageParameters- the (optional) message parameters.- Returns:
- the absent message representation, of
nullif the resolver cannot create such representation.
-
-