Package com.sap.cds.reflect
Interface CdsModel
public interface CdsModel
The CdsModel represents the complete CDS model and is the starting point for
the introspection.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaccept(CdsVisitor visitor) Accepts aCdsVisitorvisiting the definitions in this model (depth-first)actions()Returns a sequentialStreamover allCdsActiondefinitions in this model.Stream<CdsAnnotation<?>>annotations(String namespace) Returns a sequentialStreamover allCdsAnnotation(s)for the given namespace.aspects()Returns a sequentialStreamover all aspect definitions in this model.Returns a sequentialStreamover all non abstractCdsEntitydefinitions in this model.entities()Returns a sequentialStreamover allCdsEntitydefinitions in this model.events()Returns a sequentialStreamover allCdsEventdefinitions in this model.findAction(String qualifiedName) findAspect(String qualifiedName) Returns anOptionalwrapping an aspect definition.findEntity(String qualifiedName) findFunction(String qualifiedName) Returns anOptionalwrapping aCdsFunction.findService(String qualifiedName) Returns anOptionalwrapping aCdsService.findStructuredType(String qualifiedName) Returns anOptionalwrapping aCdsStructuredType.Returns a sequentialStreamover allCdsFunctiondefinitions in this model.Get aCdsActionvia its fully qualified name.Get an aspect definition via its fully qualified name.Get aCdsEntityvia its fully qualified name.Get aCdsEventvia its fully qualified name.getFunction(String qualifiedName) Get aCdsFunctionvia its fully qualified name.<T> TReturns the meta property for the given key.getService(String qualifiedName) Get aCdsServicevia its fully qualified name.getStructuredType(String qualifiedName) Get aCdsStructuredTypevia its fully qualified name.<T extends CdsType>
TGet aCdsTypevia its fully qualified name.Returns the CSN version this model was read from.static CdsModelread(InputStream csn) Creates a CDS model from a CSN input stream.static CdsModelCreates a CDS model from a CSN String.static CdsModel.Readerreader()services()Returns a sequentialStreamover allCdsServicedefinitions in this model.Returns a sequentialStreamover allCdsStructuredTypedefinitions in this model.types()Returns a sequentialStreamover allCdsTypedefinitions in this model.
-
Field Details
-
reader
-
-
Method Details
-
reader
-
read
Creates a CDS model from a CSN input stream.- Parameters:
csn- the CSN input stream- Returns:
- the CDS model
-
read
Creates a CDS model from a CSN String.- Parameters:
csn- the CSN input as String- Returns:
- the CDS model
-
annotations
Returns a sequentialStreamover allCdsAnnotation(s)for the given namespace.- Parameters:
namespace- the namespace- Returns:
- a sequential
StreamoverCdsAnnotation(s)for the given namespace
-
services
Stream<CdsService> services()Returns a sequentialStreamover allCdsServicedefinitions in this model.- Returns:
- a sequential
Streamover theCdsServicedefinitions
-
getService
Get aCdsServicevia its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of theCdsService- Returns:
- the
CdsServicewith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsServicewith the given name
-
findService
Returns anOptionalwrapping aCdsService.- Parameters:
qualifiedName- the fully qualified name of theCdsService- Returns:
- an
Optionaldescribing theCdsServicewith the given qualified name, or an emptyOptionalif there is noCdsServicewith this name
-
types
Returns a sequentialStreamover allCdsTypedefinitions in this model.- Returns:
- a sequential
Streamover theCdsTypedefinitions
-
getType
Get aCdsTypevia its fully qualified name.- Type Parameters:
T- the return type- Parameters:
qualifiedName- the fully qualified name of theCdsType- Returns:
- the
CdsTypewith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsTypewith the given name
-
findType
- Type Parameters:
T- the return type- Parameters:
qualifiedName- the fully qualified name of theCdsType- Returns:
- an
Optionaldescribing theCdsTypewith the given qualified name, or an emptyOptionalif there is noCdsTypewith this name
-
entities
Returns a sequentialStreamover allCdsEntitydefinitions in this model.- Returns:
- a sequential
Streamover theCdsEntitydefinitions
-
concreteEntities
Returns a sequentialStreamover all non abstractCdsEntitydefinitions in this model.- Returns:
- a sequential
Streamover the non abstractCdsEntitydefinitions
-
getEntity
Get aCdsEntityvia its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of theCdsEntity- Returns:
- the
CdsEntitywith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsEntitywith the given name
-
findEntity
- Parameters:
qualifiedName- the fully qualified name of theCdsEntity- Returns:
- an
Optionaldescribing theCdsEntitywith the given qualified name, or an emptyOptionalif there is noCdsEntitywith this name
-
actions
Returns a sequentialStreamover allCdsActiondefinitions in this model.- Returns:
- a sequential
Streamover theCdsActiondefinitions
-
getAction
Get aCdsActionvia its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of theCdsAction- Returns:
- the
CdsActionwith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsActionwith the given name
-
findAction
- Parameters:
qualifiedName- the fully qualified name of theCdsAction- Returns:
- an
Optionaldescribing theCdsActionwith the given qualified name, or an emptyOptionalif there is noCdsActionwith this name
-
functions
Stream<CdsFunction> functions()Returns a sequentialStreamover allCdsFunctiondefinitions in this model.- Returns:
- a sequential
Streamover theCdsFunctiondefinitions
-
getFunction
Get aCdsFunctionvia its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of theCdsFunction- Returns:
- the
CdsFunctionwith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsFunctionwith the given name
-
findFunction
Returns anOptionalwrapping aCdsFunction.- Parameters:
qualifiedName- the fully qualified name of theCdsFunction- Returns:
- an
Optionaldescribing theCdsFunctionwith the given qualified name, or an emptyOptionalif there is noCdsFunctionwith this name
-
events
Returns a sequentialStreamover allCdsEventdefinitions in this model.- Returns:
- a sequential
Streamover theCdsEventdefinitions
-
getEvent
Get aCdsEventvia its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of theCdsEvent- Returns:
- the
CdsEventwith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsEventwith the given name
-
findEvent
- Parameters:
qualifiedName- the fully qualified name of theCdsEvent- Returns:
- an
Optionaldescribing theCdsEventwith the given qualified name, or an emptyOptionalif there is noCdsEventwith this name
-
structuredTypes
Stream<CdsStructuredType> structuredTypes()Returns a sequentialStreamover allCdsStructuredTypedefinitions in this model.- Returns:
- a sequential
Streamover theCdsStructuredTypedefinitions
-
getStructuredType
Get aCdsStructuredTypevia its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of theCdsStructuredType- Returns:
- the
CdsStructuredTypewith the given fully qualified name - Throws:
CdsDefinitionNotFoundException- if there is noCdsStructuredTypewith the given name
-
findStructuredType
Returns anOptionalwrapping aCdsStructuredType.- Parameters:
qualifiedName- the fully qualified name of theCdsStructuredType- Returns:
- an
Optionaldescribing theCdsStructuredTypewith the given qualified name, or an emptyOptionalif there is noCdsStructuredTypewith this name
-
aspects
Stream<CdsStructuredType> aspects()Returns a sequentialStreamover all aspect definitions in this model.- Returns:
- a sequential
Streamover the aspect definitions
-
getAspect
Get an aspect definition via its fully qualified name.- Parameters:
qualifiedName- the fully qualified name of the aspect definition- Returns:
- the aspect definition with the given fully qualified name
- Throws:
CdsDefinitionNotFoundException- if there is no aspect definition with the given name
-
findAspect
Returns anOptionalwrapping an aspect definition.- Parameters:
qualifiedName- the fully qualified name of the aspect definition- Returns:
- an
Optionaldescribing the aspect definition with the given qualified name, or an emptyOptionalif there is no aspect definition with this name
-
getMeta
Returns the meta property for the given key.- Type Parameters:
T- the expected type of the meta property- Parameters:
key- the qualified name of the meta property- Returns:
- the value of the meta property or
nullif there is no property with the given key
-
getVersion
String getVersion()Returns the CSN version this model was read from.- Returns:
- the CSN version
-
accept
Accepts aCdsVisitorvisiting the definitions in this model (depth-first)- Parameters:
visitor- theCdsVisitor
-