Package com.sap.cds.reflect.overlay
Interface CdsEntityExtender
@Beta
public interface CdsEntityExtender
The
CdsEntityExtender
allows to extend the underlying
CdsEntity
with additional elements, associations/compositions and
annotations or extend its existing elements.-
Method Summary
Modifier and TypeMethodDescriptionaddAnnotation
(String key, Object value) Adds an annotation to the entity.addAssociation
(String name) Returns a newCdsAssociationExtender
for an association with the given name to be added to the entity.addComposition
(String name) Returns a newCdsAssociationExtender
for a composition with the given name to be added to the entity.addElement
(String name) Creates a newCdsElementExtender
for an element with the given name to be added to the entity.and()
Returns to theCdsModelExtender
that created thisCdsEntityExtender
.Returns a newCdsElementExtender
for an element with the given name.Sets theCqnSelect
query for the entity.
-
Method Details
-
addElement
Creates a newCdsElementExtender
for an element with the given name to be added to the entity. If the entity has an element with the same name already, anIllegalArgumentException
is thrown.- Parameters:
name
- the name of the element to add- Returns:
- a
CdsElementExtender
to further configure the element - Throws:
IllegalArgumentException
- if an element with the same name already exists
-
element
Returns a newCdsElementExtender
for an element with the given name. If the element does not exist in the entity, aCdsElementNotFoundException
is thrown.- Parameters:
name
- the name of the element to extend- Returns:
- a
CdsElementExtender
to further configure the element - Throws:
CdsElementNotFoundException
- if the element does not exist in the entity
-
addAssociation
Returns a newCdsAssociationExtender
for an association with the given name to be added to the entity. If the entity has an element with the same name already, anIllegalArgumentException
is thrown.- Parameters:
name
- the name of the association to add- Returns:
- a
CdsAssociationExtender
to further configure the association - Throws:
IllegalArgumentException
- if an element with the same name already exists
-
addComposition
Returns a newCdsAssociationExtender
for a composition with the given name to be added to the entity. If the entity has an element with the same name already, anIllegalArgumentException
is thrown.- Parameters:
name
- the name of the composition to add- Returns:
- a
CdsAssociationExtender
to further configure the composition - Throws:
IllegalArgumentException
- if an element with the same name already exists
-
addAnnotation
Adds an annotation to the entity.- Parameters:
key
- the annotation keyvalue
- the annotation value- Returns:
- this
CdsEntityExtender
-
query
Sets theCqnSelect
query for the entity.- Parameters:
query
- the query- Returns:
- this
CdsEntityExtender
-
and
CdsModelExtender and()Returns to theCdsModelExtender
that created thisCdsEntityExtender
.- Returns:
- the
CdsModelExtender
to continue extending the model
-