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 Details

  • Constructor Details

    • TestEngineMessageResolver

      public TestEngineMessageResolver()
  • Method Details

    • resolveMessage

      public String resolveMessage(ITemplateContext context, Class<?> origin, String key, Object[] messageParameters)
      Description copied from interface: IMessageResolver

      Resolve the message, returning the requested message (or null if not found).

      Message resolvers should perform resolution of the key + messageParameters pair based on the context and origin specified. The context will provide information about the template and the (optional) origin about the point in template execution from which the message is being requested (usually an IProcessor or the MessageExpression class).

      Parameters:
      context - the ITemplateContext object 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 null if the message could not be resolved.
    • createAbsentMessageRepresentation

      public String createAbsentMessageRepresentation(ITemplateContext context, Class<?> origin, String key, Object[] messageParameters)
      Description copied from interface: IMessageResolver

      Create a suitable representation of an absent message (a message that could not be resolved).

      Once the entire chain of configured IMessageResolver objects is asked for a specific message and all of them return null, the engine will call this method on the first resolver in the chain. If the first resolver returns null as 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 - the ITemplateContext object 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 null if the resolver cannot create such representation.