Interface Message
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DefaultMessage
public interface Message extends Serializable
Basic interface for all messages.A
Messageis not a simple String but all the information needed to create those Strings for multiple situations. The situation is determined by the usedMessageContext.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Messageargument(Serializable... arguments)Messageargument(Collection<Serializable> arguments)Argument.MessageargumentArray(Serializable[] arguments)Argument array.Object[]getArguments()StringgetTemplate()Messagetemplate(String messageTemplate)StringtoString()Renders the Message to a String, using theMessageContextwhich created the Message.StringtoString(String category)Renders the Message to a String, using theMessageContextwhich created the Message.StringtoString(MessageContext messageContext)Renders the Message to a String, using an arbitraryMessageContext.StringtoString(MessageContext messageContext, String category)Renders the Message to a String, using an arbitraryMessageContext.
-
-
-
Method Detail
-
template
Message template(String messageTemplate)
- Parameters:
messageTemplate- message key (or plain text) for the current message- Returns:
- the current instance of the message builder to allow a fluent API
-
argument
Message argument(Serializable... arguments)
- Parameters:
arguments- numbered and/or named argument(s) for the current message- Returns:
- the current instance of the message builder to allow a fluent API
-
argumentArray
Message argumentArray(Serializable[] arguments)
Argument array. Similar to argument except it is meant to handle an array being passed in via a chain.- Parameters:
arguments- the arguments- Returns:
- the message
-
argument
Message argument(Collection<Serializable> arguments)
Argument. Similar to the other argument methods, this one handles collections.- Parameters:
arguments- the arguments- Returns:
- the message
-
getTemplate
String getTemplate()
- Returns:
- the message key (or plain text) of the current message
-
getArguments
Object[] getArguments()
- Returns:
- all named and numbered arguments
-
toString
String toString()
Renders the Message to a String, using theMessageContextwhich created the Message.
-
toString
String toString(MessageContext messageContext)
Renders the Message to a String, using an arbitraryMessageContext.- Parameters:
messageContext- message context- Returns:
- Renders the Message as String
-
toString
String toString(String category)
Renders the Message to a String, using theMessageContextwhich created the Message. While resolving the message we will first search for a messageTemplate with the given category by just adding an underscore '_' and the category String to thegetTemplate(). If no such template exists we will fall back to the version without the category String.DeltaSpike JSF messages e.g. distinguish between categories
"summary"and"detail"to allow a short and a more detailed explanation in Error, Warn and Info popups at the same time.- Parameters:
category- category- Returns:
- Renders the Message as String
-
toString
String toString(MessageContext messageContext, String category)
Renders the Message to a String, using an arbitraryMessageContext. While resolving the message we will first search for a messageTemplate with the given category by just adding an underscore '_' and the category String to thegetTemplate(). If no such template exists we will fall back to the version without the category String.- Parameters:
messageContext- message context objectcategory- category- Returns:
- Renders the Message as String
-
-