Package com.sap.cds.services.messages
Interface Messages
public interface Messages
API to create
Messages with different severity within the RequestContext.
Messages provide additional information which may be added to the request's response.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdds a newMessagewith severityMessage.Severity.ERRORto the current request with the given message text or format and format parameters.Adds a newMessagewith severityMessage.Severity.INFOto the current request with the given message text or format and format parameters.Removes all messages matching the given filter.stream()Returns aStreamof the added messages in the current request contextAdds a newMessagewith severityMessage.Severity.SUCCESSto the current request with the given message text or format and format parameters.voidThrows a service exception, if error messages have been added to the current request.Adds a newMessagewith severityMessage.Severity.WARNINGto the current request with the given message text or format and format parameters.
-
Method Details
-
info
Adds a newMessagewith severityMessage.Severity.INFOto the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.- Parameters:
messageOrKey- The formatting message, based on SLF4J'sMessageFormatter, or a key to a message format in the resource bundles.args- The argument objects for the format string.- Returns:
- The resulting
Messageobject which can be adapted accordingly
-
success
Adds a newMessagewith severityMessage.Severity.SUCCESSto the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.- Parameters:
messageOrKey- The formatting message, based on SLF4J'sMessageFormatter, or a key to a message format in the resource bundles.args- The argument objects for the format string.- Returns:
- The resulting
Messageobject which can be adapted accordingly
-
warn
Adds a newMessagewith severityMessage.Severity.WARNINGto the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.- Parameters:
messageOrKey- The formatting message, based on SLF4J'sMessageFormatter, or a key to a message format in the resource bundles.args- The argument objects for the format string.- Returns:
- The resulting
Messageobject which can be adapted accordingly
-
error
Adds a newMessagewith severityMessage.Severity.ERRORto the current request with the given message text or format and format parameters. In case a key to a message format is passed, the request's locale is taken for localization.- Parameters:
messageOrKey- The formatting message, based on SLF4J'sMessageFormatter, or a key to a message format in the resource bundles.args- The argument objects for the format string.- Returns:
- The resulting
Messageobject which can be adapted accordingly
-
stream
Returns aStreamof the added messages in the current request context- Returns:
- The
Streamof the added messages
-
removeIf
Removes all messages matching the given filter.- Parameters:
filter- the filter matching messages that should be removed- Returns:
- The list of removed messages
-
throwIfError
Throws a service exception, if error messages have been added to the current request.- Throws:
ServiceException- if there was at least one error message added to the current request
-