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
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
accept
(CdsVisitor visitor) Accepts aCdsVisitor
visiting the definitions in this model (depth-first)actions()
Returns a sequentialStream
over allCdsAction
definitions in this model.Stream<CdsAnnotation<?>>
annotations
(String namespace) Returns a sequentialStream
over allCdsAnnotation(s)
for the given namespace.aspects()
Returns a sequentialStream
over all aspect definitions in this model.Returns a sequentialStream
over all non abstractCdsEntity
definitions in this model.entities()
Returns a sequentialStream
over allCdsEntity
definitions in this model.events()
Returns a sequentialStream
over allCdsEvent
definitions in this model.findAction
(String qualifiedName) findAspect
(String qualifiedName) Returns anOptional
wrapping an aspect definition.findEntity
(String qualifiedName) findFunction
(String qualifiedName) Returns anOptional
wrapping aCdsFunction
.findService
(String qualifiedName) Returns anOptional
wrapping aCdsService
.findStructuredType
(String qualifiedName) Returns anOptional
wrapping aCdsStructuredType
.Returns a sequentialStream
over allCdsFunction
definitions in this model.Get aCdsAction
via its fully qualified name.Get an aspect definition via its fully qualified name.Get aCdsEntity
via its fully qualified name.Get aCdsEvent
via its fully qualified name.getFunction
(String qualifiedName) Get aCdsFunction
via its fully qualified name.<T> T
Returns the meta property for the given key.getService
(String qualifiedName) Get aCdsService
via its fully qualified name.getStructuredType
(String qualifiedName) Get aCdsStructuredType
via its fully qualified name.<T extends CdsType>
TGet aCdsType
via its fully qualified name.Returns the CSN version this model was read from.static CdsModel
read
(InputStream csn) Creates a CDS model from a CSN input stream.static CdsModel
Creates a CDS model from a CSN String.static CdsModel.Reader
reader()
services()
Returns a sequentialStream
over allCdsService
definitions in this model.Returns a sequentialStream
over allCdsStructuredType
definitions in this model.types()
Returns a sequentialStream
over allCdsType
definitions 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 sequentialStream
over allCdsAnnotation(s)
for the given namespace.- Parameters:
namespace
- the namespace- Returns:
- a sequential
Stream
overCdsAnnotation(s)
for the given namespace
-
services
Stream<CdsService> services()Returns a sequentialStream
over allCdsService
definitions in this model.- Returns:
- a sequential
Stream
over theCdsService
definitions
-
getService
Get aCdsService
via its fully qualified name.- Parameters:
qualifiedName
- the fully qualified name of theCdsService
- Returns:
- the
CdsService
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsService
with the given name
-
findService
Returns anOptional
wrapping aCdsService
.- Parameters:
qualifiedName
- the fully qualified name of theCdsService
- Returns:
- an
Optional
describing theCdsService
with the given qualified name, or an emptyOptional
if there is noCdsService
with this name
-
types
Returns a sequentialStream
over allCdsType
definitions in this model.- Returns:
- a sequential
Stream
over theCdsType
definitions
-
getType
Get aCdsType
via its fully qualified name.- Type Parameters:
T
- the return type- Parameters:
qualifiedName
- the fully qualified name of theCdsType
- Returns:
- the
CdsType
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsType
with the given name
-
findType
- Type Parameters:
T
- the return type- Parameters:
qualifiedName
- the fully qualified name of theCdsType
- Returns:
- an
Optional
describing theCdsType
with the given qualified name, or an emptyOptional
if there is noCdsType
with this name
-
entities
Returns a sequentialStream
over allCdsEntity
definitions in this model.- Returns:
- a sequential
Stream
over theCdsEntity
definitions
-
concreteEntities
Returns a sequentialStream
over all non abstractCdsEntity
definitions in this model.- Returns:
- a sequential
Stream
over the non abstractCdsEntity
definitions
-
getEntity
Get aCdsEntity
via its fully qualified name.- Parameters:
qualifiedName
- the fully qualified name of theCdsEntity
- Returns:
- the
CdsEntity
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsEntity
with the given name
-
findEntity
- Parameters:
qualifiedName
- the fully qualified name of theCdsEntity
- Returns:
- an
Optional
describing theCdsEntity
with the given qualified name, or an emptyOptional
if there is noCdsEntity
with this name
-
actions
Returns a sequentialStream
over allCdsAction
definitions in this model.- Returns:
- a sequential
Stream
over theCdsAction
definitions
-
getAction
Get aCdsAction
via its fully qualified name.- Parameters:
qualifiedName
- the fully qualified name of theCdsAction
- Returns:
- the
CdsAction
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsAction
with the given name
-
findAction
- Parameters:
qualifiedName
- the fully qualified name of theCdsAction
- Returns:
- an
Optional
describing theCdsAction
with the given qualified name, or an emptyOptional
if there is noCdsAction
with this name
-
functions
Stream<CdsFunction> functions()Returns a sequentialStream
over allCdsFunction
definitions in this model.- Returns:
- a sequential
Stream
over theCdsFunction
definitions
-
getFunction
Get aCdsFunction
via its fully qualified name.- Parameters:
qualifiedName
- the fully qualified name of theCdsFunction
- Returns:
- the
CdsFunction
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsFunction
with the given name
-
findFunction
Returns anOptional
wrapping aCdsFunction
.- Parameters:
qualifiedName
- the fully qualified name of theCdsFunction
- Returns:
- an
Optional
describing theCdsFunction
with the given qualified name, or an emptyOptional
if there is noCdsFunction
with this name
-
events
Returns a sequentialStream
over allCdsEvent
definitions in this model.- Returns:
- a sequential
Stream
over theCdsEvent
definitions
-
getEvent
Get aCdsEvent
via its fully qualified name.- Parameters:
qualifiedName
- the fully qualified name of theCdsEvent
- Returns:
- the
CdsEvent
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsEvent
with the given name
-
findEvent
- Parameters:
qualifiedName
- the fully qualified name of theCdsEvent
- Returns:
- an
Optional
describing theCdsEvent
with the given qualified name, or an emptyOptional
if there is noCdsEvent
with this name
-
structuredTypes
Stream<CdsStructuredType> structuredTypes()Returns a sequentialStream
over allCdsStructuredType
definitions in this model.- Returns:
- a sequential
Stream
over theCdsStructuredType
definitions
-
getStructuredType
Get aCdsStructuredType
via its fully qualified name.- Parameters:
qualifiedName
- the fully qualified name of theCdsStructuredType
- Returns:
- the
CdsStructuredType
with the given fully qualified name - Throws:
CdsDefinitionNotFoundException
- if there is noCdsStructuredType
with the given name
-
findStructuredType
Returns anOptional
wrapping aCdsStructuredType
.- Parameters:
qualifiedName
- the fully qualified name of theCdsStructuredType
- Returns:
- an
Optional
describing theCdsStructuredType
with the given qualified name, or an emptyOptional
if there is noCdsStructuredType
with this name
-
aspects
Stream<CdsStructuredType> aspects()Returns a sequentialStream
over all aspect definitions in this model.- Returns:
- a sequential
Stream
over 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 anOptional
wrapping an aspect definition.- Parameters:
qualifiedName
- the fully qualified name of the aspect definition- Returns:
- an
Optional
describing the aspect definition with the given qualified name, or an emptyOptional
if 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
null
if 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 aCdsVisitor
visiting the definitions in this model (depth-first)- Parameters:
visitor
- theCdsVisitor
-