Package com.sap.cds.services.messages
Interface Messages
public interface Messages
API to create
Message
s with different severity within the RequestContext
.
Message
s provide additional information which may be added to the request's response.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdds a newMessage
with severityMessage.Severity.ERROR
to the current request with the given message text or format and format parameters.Adds a newMessage
with severityMessage.Severity.INFO
to the current request with the given message text or format and format parameters.stream()
Returns aStream
of the added messages in the current request contextAdds a newMessage
with severityMessage.Severity.SUCCESS
to the current request with the given message text or format and format parameters.void
Throws a service exception, if error messages have been added to the current request.Adds a newMessage
with severityMessage.Severity.WARNING
to the current request with the given message text or format and format parameters.
-
Method Details
-
info
Adds a newMessage
with severityMessage.Severity.INFO
to 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 message format or a key to a message format in the resource bundles.params
- The parameters to fill the message format.- Returns:
- The resulting
Message
object which can be adapted accordingly
-
success
Adds a newMessage
with severityMessage.Severity.SUCCESS
to 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 message format or a key to a message format in the resource bundles.params
- The parameters to fill the message format.- Returns:
- The resulting
Message
object which can be adapted accordingly
-
warn
Adds a newMessage
with severityMessage.Severity.WARNING
to 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 message format or a key to a message format in the resource bundles.params
- The parameters to fill the message format.- Returns:
- The resulting
Message
object which can be adapted accordingly
-
error
Adds a newMessage
with severityMessage.Severity.ERROR
to 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 message format or a key to a message format in the resource bundles.params
- The parameters to fill the message format.- Returns:
- The resulting
Message
object which can be adapted accordingly
-
stream
Returns aStream
of the added messages in the current request context- Returns:
- The
Stream
of the added 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
-