public interface ServiceExceptionUtils
ServiceException
.
ServiceExceptionUtils#getMessage
is used to implement ServiceException#getMessage
and
ServiceExceptionUtils#getLocalizedMessage
is used to implement ServiceException#getLocalizedMessage
respectively.
Modifier and Type | Method and Description |
---|---|
String |
getLocalizedMessage(String code,
Object[] args,
Locale locale)
Creates a message based on code and args.
|
String |
getMessage(String code,
Object[] args)
Creates a message based on code and args.
|
MessageTarget |
getMessageTarget(String target)
Creates a new
MessageTarget with a string-based target |
<E extends com.sap.cds.ql.StructuredType<E>> |
getMessageTarget(String prefix,
Class<E> entity,
Function<E,Object> path)
Creates a new
MessageTarget with a target, based on a CQN path and a string-based prefix |
MessageTarget |
getMessageTarget(String prefix,
String entity,
Function<com.sap.cds.ql.StructuredType<?>,Object> path)
Creates a new
MessageTarget with a target, based on a CQN path and a string-based prefix |
String getMessage(String code, Object[] args)
code
may either be a SL4J-message format or a bundle key.
The JVM's default locale is taken to lookup code in resource bundles.code
- The used codeargs
- The arguments for message formats.String getLocalizedMessage(String code, Object[] args, Locale locale)
code
may 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 is null
the locale provided of the current RequestContext
is usedcode
- The used codeargs
- The arguments for message formats.locale
- The localeMessageTarget getMessageTarget(String target)
MessageTarget
with a string-based targettarget
- the string-based targetMessageTarget
MessageTarget getMessageTarget(String prefix, String entity, Function<com.sap.cds.ql.StructuredType<?>,Object> path)
MessageTarget
with a target, based on a CQN path and a string-based prefixprefix
- the string-based prefix, prepended to the CQN pathentity
- the root entity of the pathpath
- the path to the targetMessageTarget
<E extends com.sap.cds.ql.StructuredType<E>> MessageTarget getMessageTarget(String prefix, Class<E> entity, Function<E,Object> path)
MessageTarget
with a target, based on a CQN path and a string-based prefixE
- the entity typeprefix
- the string-based prefix, prepended to the CQN pathentity
- the root entity of the pathpath
- the path to the targetMessageTarget
Copyright © 2020. All rights reserved.