Interface CdsModel


  • public interface CdsModel
    The CdsModel represents the complete CDS model and is the starting point for the introspection.
    • Method Detail

      • read

        static CdsModel read​(InputStream csn)
        Creates a CDS model from a CSN input stream.
        Parameters:
        csn - the CSN input stream
        Returns:
        the CDS model
      • read

        static CdsModel read​(String csn)
        Creates a CDS model from a CSN String.
        Parameters:
        csn - the CSN input as String
        Returns:
        the CDS model
      • annotations

        Stream<CdsAnnotation<?>> annotations​(String namespace)
        Returns a sequential Stream over all CdsAnnotation(s) for the given namespace.
        Parameters:
        namespace - the namespace
        Returns:
        a sequential Stream over CdsAnnotation(s) for the given namespace
      • getService

        CdsService getService​(String qualifiedName)
        Get a CdsService via its fully qualified name.
        Parameters:
        qualifiedName - the fully qualified name of the CdsService
        Returns:
        the CdsService with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsService with the given name
      • findService

        Optional<CdsService> findService​(String qualifiedName)
        Returns an Optional wrapping a CdsService.
        Parameters:
        qualifiedName - the fully qualified name of the CdsService
        Returns:
        an Optional describing the CdsService with the given qualified name, or an empty Optional if there is no CdsService with this name
      • types

        Stream<CdsType> types()
        Returns a sequential Stream over all CdsType definitions in this model.
        Returns:
        a sequential Stream over the CdsType definitions
      • getType

        <T extends CdsType> T getType​(String qualifiedName)
        Get a CdsType via its fully qualified name.
        Type Parameters:
        T - the return type
        Parameters:
        qualifiedName - the fully qualified name of the CdsType
        Returns:
        the CdsType with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsType with the given name
      • findType

        <T extends CdsTypeOptional<T> findType​(String qualifiedName)
        Returns an Optional wrapping a CdsType.
        Type Parameters:
        T - the return type
        Parameters:
        qualifiedName - the fully qualified name of the CdsType
        Returns:
        an Optional describing the CdsType with the given qualified name, or an empty Optional if there is no CdsType with this name
      • entities

        Stream<CdsEntity> entities()
        Returns a sequential Stream over all CdsEntity definitions in this model.
        Returns:
        a sequential Stream over the CdsEntity definitions
      • concreteEntities

        default Stream<CdsEntity> concreteEntities()
        Returns a sequential Stream over all non abstract CdsEntity definitions in this model.
        Returns:
        a sequential Stream over the non abstract CdsEntity definitions
      • getEntity

        CdsEntity getEntity​(String qualifiedName)
        Get a CdsEntity via its fully qualified name.
        Parameters:
        qualifiedName - the fully qualified name of the CdsEntity
        Returns:
        the CdsEntity with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsEntity with the given name
      • findEntity

        Optional<CdsEntity> findEntity​(String qualifiedName)
        Returns an Optional wrapping a CdsEntity.
        Parameters:
        qualifiedName - the fully qualified name of the CdsEntity
        Returns:
        an Optional describing the CdsEntity with the given qualified name, or an empty Optional if there is no CdsEntity with this name
      • actions

        Stream<CdsAction> actions()
        Returns a sequential Stream over all CdsAction definitions in this model.
        Returns:
        a sequential Stream over the CdsAction definitions
      • getAction

        CdsAction getAction​(String qualifiedName)
        Get a CdsAction via its fully qualified name.
        Parameters:
        qualifiedName - the fully qualified name of the CdsAction
        Returns:
        the CdsAction with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsAction with the given name
      • findAction

        Optional<CdsAction> findAction​(String qualifiedName)
        Returns an Optional wrapping a CdsAction.
        Parameters:
        qualifiedName - the fully qualified name of the CdsAction
        Returns:
        an Optional describing the CdsAction with the given qualified name, or an empty Optional if there is no CdsAction with this name
      • getFunction

        CdsFunction getFunction​(String qualifiedName)
        Get a CdsFunction via its fully qualified name.
        Parameters:
        qualifiedName - the fully qualified name of the CdsFunction
        Returns:
        the CdsFunction with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsFunction with the given name
      • findFunction

        Optional<CdsFunction> findFunction​(String qualifiedName)
        Returns an Optional wrapping a CdsFunction.
        Parameters:
        qualifiedName - the fully qualified name of the CdsFunction
        Returns:
        an Optional describing the CdsFunction with the given qualified name, or an empty Optional if there is no CdsFunction with this name
      • events

        Stream<CdsEvent> events()
        Returns a sequential Stream over all CdsEvent definitions in this model.
        Returns:
        a sequential Stream over the CdsEvent definitions
      • getEvent

        CdsEvent getEvent​(String qualifiedName)
        Get a CdsEvent via its fully qualified name.
        Parameters:
        qualifiedName - the fully qualified name of the CdsEvent
        Returns:
        the CdsEvent with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsEvent with the given name
      • findEvent

        Optional<CdsEvent> findEvent​(String qualifiedName)
        Returns an Optional wrapping a CdsEvent.
        Parameters:
        qualifiedName - the fully qualified name of the CdsEvent
        Returns:
        an Optional describing the CdsEvent with the given qualified name, or an empty Optional if there is no CdsEvent with this name
      • getStructuredType

        CdsStructuredType getStructuredType​(String qualifiedName)
        Get a CdsStructuredType via its fully qualified name.
        Parameters:
        qualifiedName - the fully qualified name of the CdsStructuredType
        Returns:
        the CdsStructuredType with the given fully qualified name
        Throws:
        CdsDefinitionNotFoundException - if there is no CdsStructuredType with the given name
      • findStructuredType

        Optional<CdsStructuredType> findStructuredType​(String qualifiedName)
        Returns an Optional wrapping a CdsStructuredType.
        Parameters:
        qualifiedName - the fully qualified name of the CdsStructuredType
        Returns:
        an Optional describing the CdsStructuredType with the given qualified name, or an empty Optional if there is no CdsStructuredType with this name
      • aspects

        Stream<CdsStructuredType> aspects()
        Returns a sequential Stream over all aspect definitions in this model.
        Returns:
        a sequential Stream over the aspect definitions
      • getAspect

        CdsStructuredType getAspect​(String qualifiedName)
        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

        Optional<CdsStructuredType> findAspect​(String qualifiedName)
        Returns an Optional 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 empty Optional if there is no aspect definition with this name
      • getMeta

        <T> T getMeta​(String key)
        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

        default void accept​(CdsVisitor visitor)
        Accepts a CdsVisitor visiting the definitions in this model (depth-first)
        Parameters:
        visitor - the CdsVisitor