Package com.sap.cds.services
Interface CoreFactory
public interface CoreFactory
Factory to create various objects for API interfaces.
This class should never be used directly by application code and is only intended for internal usage in cds-services-api.
Applications rather should use the specific
create
methods on the target interfaces.
The implementation of the factory is loaded via ExtendedServiceLoader
and is therefore pluggable.-
Field Summary
Modifier and TypeFieldDescriptionstatic final CoreFactory
The instance loaded viaExtendedServiceLoader
. -
Method Summary
Modifier and TypeMethodDescriptioncreateCdsRuntimeConfigurer
(PropertiesProvider propertiesProvider) The factory method to create a newCdsRuntimeConfigurer
with the given properties.The factory method to create a newChangeSetContextAccessor
.The factory method to create a newChangeSetContextSPI
.createEventContext
(String event, String entityName) The factory method to create a newEventContext
.createFeatureTogglesInfo
(List<FeatureToggle> featureToggles) Creates aFeatureTogglesInfo
object.createFeatureTogglesInfo
(Map<String, Boolean> featureToggles) Creates aFeatureTogglesInfo
object.createMessage
(Message.Severity severity, String text) Creates aMessage
object.createMessage
(Message.Severity severity, String text, Message message) Creates aMessage
object.createMessage
(String text, ServiceException exception) Creates aMessage
object.createParameterInfo
(ParameterInfo parameterInfo) Creates aModifiableParameterInfo
based on the passedParameterInfo
.The factory method to create a newRequestContextAccessor
.createService
(String name) The factory method to create a newService
.createService
(String name, Service delegator) The factory method to create a newServiceExceptionUtils
.createUserInfo
(UserInfo userInfo) Creates aModifiableUserInfo
based on the passedUserInfo
.
-
Field Details
-
INSTANCE
The instance loaded viaExtendedServiceLoader
.
-
-
Method Details
-
createEventContext
The factory method to create a newEventContext
. Application code should useEventContext.create(String, String)
instead.- Parameters:
event
- the name of the evententityName
- the name of the entity- Returns:
- the
EventContext
-
createService
The factory method to create a newService
. Application code should useEventContext.create(String, String)
instead.- Parameters:
name
- the name of the service- Returns:
- the
Service
-
createService
The factory method to create a newService
with a given delegatorService
. This method is intended to be used only byServiceDelegator
. -
createCdsRuntimeConfigurer
The factory method to create a newCdsRuntimeConfigurer
with the given properties. Application code should useCdsRuntimeConfigurer.create()
orCdsRuntimeConfigurer.create(PropertiesProvider)
instead.- Parameters:
propertiesProvider
- thePropertiesProvider
, may benull
, which means a simplePropertiesProvider
providing defaultCdsProperties
is used- Returns:
- the
CdsRuntimeConfigurer
-
createRequestContextAccessor
RequestContextAccessor createRequestContextAccessor()The factory method to create a newRequestContextAccessor
. This method is intended to be used only byRequestContext
.- Returns:
- the
RequestContextAccessor
-
createChangeSetContextAccessor
ChangeSetContextAccessor createChangeSetContextAccessor()The factory method to create a newChangeSetContextAccessor
. This method is intended to be used only byChangeSetContext
.- Returns:
- the
ChangeSetContextAccessor
-
createChangeSetContextSPI
ChangeSetContextSPI createChangeSetContextSPI()The factory method to create a newChangeSetContextSPI
. Application code should useChangeSetContextSPI.open()
instead.- Returns:
- the
ChangeSetContextSPI
-
createParameterInfo
Creates aModifiableParameterInfo
based on the passedParameterInfo
. IfparameterInfo
isnull
, aModifiableParameterInfo
based on default values of a clearParameterInfo
is returned. Application code should useParameterInfo.create()
orParameterInfo.copy()
instead.- Parameters:
parameterInfo
- TheParameterInfo
as basis.- Returns:
- The created
ModifiableParameterInfo
instance.
-
createUserInfo
Creates aModifiableUserInfo
based on the passedUserInfo
. IfuserInfo
isnull
, aModifiableUserInfo
based on default values of a clearUserInfo
is returned. Application code should useUserInfo.create()
orUserInfo.copy()
instead.- Parameters:
userInfo
- TheUserInfo
as basis.- Returns:
- The created
ModifiableUserInfo
instance.
-
createFeatureTogglesInfo
Creates aFeatureTogglesInfo
object. Application code should useFeatureTogglesInfo.create(List)
instead.- Parameters:
featureToggles
- AList
of feature toggles- Returns:
- A
FeatureTogglesInfo
object containing all provided feature toggles in the stream
-
createFeatureTogglesInfo
Creates aFeatureTogglesInfo
object. Application code should useFeatureTogglesInfo.create(Map)
instead.- Parameters:
featureToggles
- AMap
where the key is the feature name and the value indicates if the feature is enable or not- Returns:
- A
FeatureTogglesInfo
object containing the feature toggles created from the map entries
-
createServiceExceptionUtils
ServiceExceptionUtils createServiceExceptionUtils()The factory method to create a newServiceExceptionUtils
. This method is intended to be used only byServiceException
.- Returns:
- the
ServiceExceptionUtils
-
createMessage
Creates aMessage
object. Application code should useMessage.create(Severity, String)
instead.- Parameters:
severity
- theMessage.Severity
of theMessage
text
- the final text of the message- Returns:
- the
Message
-
createMessage
Creates aMessage
object. Application code should useMessage.create(String, ServiceException)
instead.- Parameters:
text
- the final text of the messageexception
- theServiceException
to copy optional arguments from- Returns:
- the
Message
-
createMessage
Creates aMessage
object. Application code should useMessage.create(Severity, String, Message)
instead.- Parameters:
severity
- theMessage.Severity
of theMessage
text
- the final text of the messagemessage
- theMessage
- Returns:
- the
Message
-