public static List<EClass> filterByContainmentFeature(
     Collection<EClass> eClasses, MappingEntry mappingEntry) {
   EClass superType = null;
   if (mappingEntry instanceof NodeMapping) {
     NodeReference nodeReference = (NodeReference) mappingEntry.eContainer();
     if (nodeReference != null) {
       EReference modelReference =
           nodeReference.getChildrenFeature() != null
               ? nodeReference.getChildrenFeature()
               : nodeReference.getContainmentFeature();
       if (modelReference != null) {
         superType = modelReference.getEReferenceType();
       }
     }
   } else if (mappingEntry instanceof LinkMapping) {
     if (((LinkMapping) mappingEntry).getContainmentFeature() != null) {
       superType = ((LinkMapping) mappingEntry).getContainmentFeature().getEReferenceType();
     }
   }
   return sort(
       getConcreteEClasses(
           getSubtypesOf(
               filterValidEObjectsFrom(eClasses, mappingEntry.eResource().getResourceSet()),
               superType)));
 }
 public static List<EStructuralFeature> filterByContainerMetaclass(
     Collection<EStructuralFeature> eReferences, MappingEntry mappingEntry) {
   EClass containerMetaClass = mappingEntry.getDomainMetaElement();
   return sort(getEStructuralFeaturesOf(eReferences, containerMetaClass));
 }