Versions Compared

Key

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

...

... creates a message with 'Hello CODI' as message descriptor and error as message-severity.
Payload is based on the validation payload of Bean-Validation. Via payload it's possible to provide additional information via a typesafe mechanism. It's possible to use the provided types of payload ( MessageSeverity or InternalMessage ) or to create custom payload like Label . It's possible to handle messages depending on the payload of the message. By default a message is created with MessageSeverity.Info .

...

Note
titleAttention!

Keep in mind that a stand-alone MessageBuilder is able to create Message objects, but it needs a MessageContext to create the final text or to add the message to the context.

Without direct access to the MessageContext you can use a MessageBuilder to create a message via:
Message message = SimpleMessageBuilder.message().text("msgKey").create();
As soon as you have a MessageContext you have access to the final message-text via:
message.toString(messageContext));
And/or you can add it to the context via:
messageContext.addMessage(message);

...

If you don't like the fluent API you can create your own message (e.g. based on DefaultMessage ) or you can just instantiate DefaultMessage .

Code Block
titleCreating a message manually
borderStylesolid
Message message = new DefaultMessage("inline message");