Package com.sap.cds.services
Interface ServiceExceptionUtils
public interface ServiceExceptionUtils
Helper methods for creating (localized) messages in
ServiceException.
ServiceExceptionUtils#getMessage is used to implement
ServiceException#getMessage and ServiceExceptionUtils#getLocalizedMessage is used to
implement ServiceException#getLocalizedMessage respectively.
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetLocalizedMessage(String code, Object[] args, Locale locale) Deprecated, for removal: This API element is subject to removal in a future version.getLocalizedMessage(String code, Object[] args, Locale locale, boolean errorStatusFallback) Creates a message based on code and args.getMessage(String code, Object[] args) Creates a message based on code and args.default MessageTargetgetMessageTarget(com.sap.cds.ql.cqn.Path path, com.sap.cds.reflect.CdsElement element) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(Path, CdsElement)instead.default MessageTargetgetMessageTarget(String target) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(String)instead.default <E extends com.sap.cds.ql.StructuredType<E>>
MessageTargetgetMessageTarget(String parameter, Class<E> type, Function<E, Object> path) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(String, Class, Function)instead.default MessageTargetgetMessageTarget(String parameter, Function<com.sap.cds.ql.StructuredType<?>, Object> path) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(String, Function)instead.
-
Method Details
-
getMessage
Creates a message based on code and args.codemay either be a SL4J-message format or a bundle key. The JVM's default locale is taken to lookup code in resource bundles.- Parameters:
code- The used codeargs- The arguments for message formats.- Returns:
- The created message
-
getLocalizedMessage
@Deprecated(forRemoval=true) default String getLocalizedMessage(String code, Object[] args, Locale locale) Deprecated, for removal: This API element is subject to removal in a future version.Creates a message based on code and args.codemay either be a SL4J-message format or a bundle key. The specified locale is taken to lookup the code in resource bundles. If the specified locale isnullthe locale provided of the currentRequestContextis used- Parameters:
code- The used codeargs- The arguments for message formats.locale- The locale- Returns:
- The created message
-
getLocalizedMessage
Creates a message based on code and args.codemay either be a SL4J-message format or a bundle key. The specified locale is taken to lookup the code in resource bundles. If the specified locale isnullthe locale provided of the currentRequestContextis used- Parameters:
code- The used codeargs- The arguments for message formats.locale- The localeerrorStatusFallback- Iftrue, a fallback to the description is done for well-knownErrorStatus.- Returns:
- The created message
-
getMessageTarget
Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(String)instead.- Parameters:
target-- Returns:
-
getMessageTarget
@Deprecated(forRemoval=true) default MessageTarget getMessageTarget(String parameter, Function<com.sap.cds.ql.StructuredType<?>, Object> path) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(String, Function)instead.- Parameters:
parameter-path-- Returns:
-
getMessageTarget
@Deprecated(forRemoval=true) default <E extends com.sap.cds.ql.StructuredType<E>> MessageTarget getMessageTarget(String parameter, Class<E> type, Function<E, Object> path) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(String, Class, Function)instead.- Type Parameters:
E-- Parameters:
parameter-type-path-- Returns:
-
getMessageTarget
@Deprecated(forRemoval=true) default MessageTarget getMessageTarget(com.sap.cds.ql.cqn.Path path, com.sap.cds.reflect.CdsElement element) Deprecated, for removal: This API element is subject to removal in a future version.UseMessageTarget.create(Path, CdsElement)instead.- Parameters:
path-element-- Returns:
-
getErrorsProperties
CdsProperties.Errors getErrorsProperties()- Returns:
- the active
CdsProperties.Errorsproperties
-
getLocalizedMessage(String, Object[], Locale, boolean)instead.