Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

... creates a message with the key 'msgKey' as message descriptor.
(The concrete syntax of a key depends on the used MessageResolver. Further details are available in the DevDoc.)

Example 3

Code Block
titleCreating messages with arguments
borderStylesolid
Message message = messageContext.message().text("Hello {0}").argument("MyFaces").create();

...

... creates the message-text based on the constructed message.

To avoid side-effects with other libs as well as IDEs there is no #toString().

Example 2

Code Block
titleCreating the message-text of a given message
borderStylesolid
//Message message = messageContext.message().text("Hello {name}").namedArgument("name", "MyFaces").create();
String messageText = message.toString(messageContext);

... creates the message-text based on the given message and MessageContext . That's essential if you would like to create the final text with a different/new MessageContext e.g. with a different configuration or with the current MessageContext if you receive a de-serialized message instance.

Processing messages

It's possible to register MessageHandler s which process or forward messages added to the MessageContext .

...