code: @SuppressWarnings("unchecked")
    public T getReferenceTargetElement(ModelElementInstance referenceSourceElement) {
      String identifier = getReferenceIdentifier(referenceSourceElement);
      ModelElementInstance referenceTargetElement = referenceSourceElement.getModelInstance().getModelElementById(identifier);
      if (referenceTargetElement != null) {
        try {
          return (T) referenceTargetElement;
  
        } catch(ClassCastException e) {
          throw new ModelReferenceException("Element " + referenceSourceElement + " references element " + referenceTargetElement + " of wrong type. "
            + "Expecting " + referenceTargetAttribute.getOwningElementType() + " got " + referenceTargetElement.getElementType());
        }
      }
      else {
        return null;
      }
    }
docs: Get the reference target model element instance
  
  @param referenceSourceElement the reference source model element instance
  @return the reference target model element instance or null if not set