Interface MessageTarget


public interface MessageTarget
  • Field Details

    • PARAMETER_CQN

      static final String PARAMETER_CQN
      Constant specifying a message target parameter, referring to the CQN of an event context.

      This is used to decide whether a binding parameter is required for the message target output.

      See Also:
  • Method Details

    • create

      static MessageTarget create(String target)
      Creates a string-based MessageTarget. No further processing of the string is performed.
      Parameters:
      target - the string-based target
      Returns:
      The created MessageTarget
    • create

      static MessageTarget create(Function<com.sap.cds.ql.StructuredType<?>,Object> path)
      Creates a MessageTarget based on a CQN path.

      The path is interpreted relative to the CQN statement, which was determined from the request. For CRUD events this CQN statement points to the targeted entity. For bound actions or functions this CQN statement points to the bound entity.

      Is equivalent to calling create(MessageTarget.PARAMETER_CQN, path)

      Parameters:
      path - the path to the target element or association
      Returns:
      The created MessageTarget
    • create

      static MessageTarget create(String parameter, Function<com.sap.cds.ql.StructuredType<?>,Object> path)
      Creates a MessageTarget based on a parameter and a CQN path.
      Parameters:
      parameter - target parameter serving as the entry point for the path resolution. Passing PARAMETER_CQN indicates that the path should be interpreted relatively to the target entity of the request. Alternatively you can pass names of action or function parameters.
      path - the path to the target element or association
      Returns:
      The created MessageTarget
    • create

      static <E extends com.sap.cds.ql.StructuredType<E>> MessageTarget create(Class<E> type, Function<E,Object> path)
      Creates a MessageTarget based on a CQN path. This method allows to build the path in a type-safe way, by passing the corresponding entity or structured type interface.

      The path is interpreted relative to the CQN statement, which was determined from the request. For CRUD events this CQN statement points to the targeted entity. For bound actions or functions this CQN statement points to the bound entity.

      Is equivalent to calling create(MessageTarget.PARAMETER_CQN, type, path)

      Type Parameters:
      E - the type of the root
      Parameters:
      type - the root type of the path. Either an entity or a structured type.
      path - the path to the target element or association
      Returns:
      The created MessageTarget
    • create

      static <E extends com.sap.cds.ql.StructuredType<E>> MessageTarget create(String parameter, Class<E> type, Function<E,Object> path)
      Creates a MessageTarget based on a parameter and a CQN path. This method allows to build the path in a type-safe way, by passing the corresponding entity or structured type interface.
      Type Parameters:
      E - the type of the root
      Parameters:
      parameter - target parameter serving as the entry point for the path resolution. Passing PARAMETER_CQN indicates that the path should be interpreted relatively to the target entity of the request. Alternatively you can pass names of action or function parameters.
      type - the root type of the path. Either an entity or a structured type.
      path - the path to the target element or association
      Returns:
      The created MessageTarget
    • create

      static MessageTarget create(com.sap.cds.ql.cqn.Path path, com.sap.cds.reflect.CdsElement element)
      Creates a MessageTarget based on a Path and a CdsElement.

      The path is interpreted relative to the CQN statement, which was determined from the request. For CRUD events this CQN statement points to the targeted entity. For bound actions or functions this CQN statement points to the bound entity.

      This method can be used with the CdsDataProcessor and its functional interfaces.

      Parameters:
      path - the path
      element - the target element or association
      Returns:
      The created MessageTarget
    • create

      static MessageTarget create(String parameter, com.sap.cds.ql.cqn.CqnReference ref)
      Creates a MessageTarget based on a parameter and a CqnReference
      Parameters:
      parameter - target parameter serving as the entry point for the path resolution. Passing PARAMETER_CQN indicates that the path should be interpreted relatively to the target entity of the request. Alternatively you can pass names of action or function parameters.
      ref - The reference to the target element or association
      Returns:
      The created MessageTarget
    • getRef

      com.sap.cds.ql.cqn.CqnReference getRef()
      Returns:
      the CQN reference of the message target
    • getParameter

      String getParameter()
      Returns:
      (target) parameter of the message target