BPMNModelElementInstance varies to different bpmn activities


#1

I was trying to get read CamundaProperty from extensionElements like below for all activities from the deployed bpmn model.

execution.getBpmnModelElementInstance() in taskListener(UserTask) returns instance of type UserTask.

But execution.getBpmnModelElementInstance() returns in JavaDelegate( configured in ServiceTask & end Listener in EndEvent) returns instance of type FlowElement.

  1. Why these differences in return type of the function getBpmnModelElementInstance()?

  2. Each unique activities in the bpmn model will return different type of instances for getBpmnModelElementInstance()?

  3. Is this return type differences of getBpmnModelElementInstance() are depends only on JavaDelegates & TaskListeners implementation or it will differ for each activity in the bpmn model?