Package de.chkal.mvctoolbox.core.message
Interface MvcMessages
- All Known Implementing Classes:
MvcMessagesImpl
public interface MvcMessages
Represents a list of messages to be displayed to the user.
Instances implementing this interface must be injectable using
Inject and are RedirectScoped.
-
Method Summary
Modifier and TypeMethodDescriptionadd(MvcMessage message) Adds the given message.add(MvcMessage.Severity severity, String text) Adds a new global message with the given severity.add(jakarta.mvc.binding.BindingResult bindingResult) This method adds one error message for each binding error or constraint violation in the given binding result.Adds a new global info message.getAll()Returns a list of all messagesReturns a list of all messages with a severity of ERROR.getInfos()Returns a list of all messages with a severity of INFO.getMessage(String param) If there is at least one message queued for the given parameter, the first one is returned.getMessages(String param) Returns a list of all messages queued for the given parameter.Returns a list of all messages with a severity of WARNING.
-
Method Details
-
add
Adds a new global info message.- Parameters:
text- The text of the message, must not benull- Returns:
- self
-
add
Adds a new global message with the given severity.- Parameters:
severity- The severity of the message, must not benulltext- The text of the message, must not benull- Returns:
- self
-
add
This method adds one error message for each binding error or constraint violation in the given binding result.- Parameters:
bindingResult- The binding result to create messages from, ust not benull- Returns:
- self
-
add
Adds the given message.- Parameters:
message- the message- Returns:
- self
-
getAll
List<MvcMessage> getAll()Returns a list of all messages- Returns:
- all messages
-
getInfos
List<MvcMessage> getInfos()Returns a list of all messages with a severity of INFO.- Returns:
- all info messages
-
getWarnings
List<MvcMessage> getWarnings()Returns a list of all messages with a severity of WARNING.- Returns:
- all warning messages
-
getErrors
List<MvcMessage> getErrors()Returns a list of all messages with a severity of ERROR.- Returns:
- all error messages
-
getMessage
If there is at least one message queued for the given parameter, the first one is returned. Will returnnullif no message for the parameter exists.- Parameters:
param- The parameter name- Returns:
- The first message for the parameter or
null - See Also:
-
getMessages
Returns a list of all messages queued for the given parameter.- Parameters:
param- The parameter name- Returns:
- All message for the given parameter
- See Also:
-