How to know the next node whether it is task, gateway or event using BPMN model API?

I want to know the type of BPMN element for each element in the model from the XML file of the model? how can I know whether the next element is gateway or task ? for example the code below can be used to get the name of the source and target reference element but I want to know the type of element?
SequenceFlow sequenceFlow
=modelInstance.getModelElementById(“SequenceFlow_11jxc49”);
FlowNode source = sequenceFlow.getSource();
System.out.println(source.getName());
FlowNode target = sequenceFlow.getTarget();
System.out.println(target.getName());

@briye you can get the class of the object.

In the model API you can get the Type which will be a instance if these classes: https://docs.camunda.org/javadoc/camunda-bpm-platform/7.5/?org/camunda/bpm/model/bpmn/instance/package-summary.html

1 Like