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 newCdsAssociationExtenderfor an association with the given name to be added to the entity.addComposition(String name) Returns a newCdsAssociationExtenderfor a composition with the given name to be added to the entity.addElement(String name) Creates a newCdsElementExtenderfor an element with the given name to be added to the entity.and()Returns to theCdsModelExtenderthat created thisCdsEntityExtender.Returns a newCdsElementExtenderfor an element with the given name.Sets theCqnSelectquery for the entity.
-
Method Details
-
addElement
Creates a newCdsElementExtenderfor an element with the given name to be added to the entity. If the entity has an element with the same name already, anIllegalArgumentExceptionis thrown.- Parameters:
name- the name of the element to add- Returns:
- a
CdsElementExtenderto further configure the element - Throws:
IllegalArgumentException- if an element with the same name already exists
-
element
Returns a newCdsElementExtenderfor an element with the given name. If the element does not exist in the entity, aCdsElementNotFoundExceptionis thrown.- Parameters:
name- the name of the element to extend- Returns:
- a
CdsElementExtenderto further configure the element - Throws:
CdsElementNotFoundException- if the element does not exist in the entity
-
addAssociation
Returns a newCdsAssociationExtenderfor an association with the given name to be added to the entity. If the entity has an element with the same name already, anIllegalArgumentExceptionis thrown.- Parameters:
name- the name of the association to add- Returns:
- a
CdsAssociationExtenderto further configure the association - Throws:
IllegalArgumentException- if an element with the same name already exists
-
addComposition
Returns a newCdsAssociationExtenderfor a composition with the given name to be added to the entity. If the entity has an element with the same name already, anIllegalArgumentExceptionis thrown.- Parameters:
name- the name of the composition to add- Returns:
- a
CdsAssociationExtenderto 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 theCqnSelectquery for the entity.- Parameters:
query- the query- Returns:
- this
CdsEntityExtender
-
and
CdsModelExtender and()Returns to theCdsModelExtenderthat created thisCdsEntityExtender.- Returns:
- the
CdsModelExtenderto continue extending the model
-