本文整理汇总了Java中org.eclipse.emf.ecore.EObject.eContainmentFeature方法的典型用法代码示例。如果您正苦于以下问题:Java EObject.eContainmentFeature方法的具体用法?Java EObject.eContainmentFeature怎么用?Java EObject.eContainmentFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.EObject
的用法示例。
在下文中一共展示了EObject.eContainmentFeature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: merge
import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
private void merge(final EObject extension, final EObject extendsEObject, final Map<String, EObject> idToEObject) {
mergeAttributes(extension, extendsEObject);
mergeCrossReferences(extension, extendsEObject, idToEObject);
for (final EObject extensionChild : extension.eContents()) {
final String uriFragment = uriFragmentBuilder.getURIFragment(extensionChild);
if (idToEObject.containsKey(uriFragment)) {
final EObject extendsChild = idToEObject.get(uriFragment);
merge(extensionChild, extendsChild, idToEObject);
} else {
final EObject copy = copy(extensionChild);
final EReference containmentFeature = extensionChild.eContainmentFeature();
if (containmentFeature.isMany()) {
final List<EObject> containment = (List<EObject>) extendsEObject.eGet(containmentFeature);
containment.add(copy);
} else {
extendsEObject.eSet(containmentFeature, copy);
}
}
}
}
示例2: getAllContentsOfTypeStopAt
import org.eclipse.emf.ecore.EObject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> List<T> getAllContentsOfTypeStopAt(boolean findFirst, EObject eobj, final Class<T> filterType,
final EReference... stopReferences) {
if (eobj == null) {
return Collections.EMPTY_LIST;
}
List<EReference> stopReferencesL = Arrays.asList(stopReferences);
List<T> contentList = new LinkedList<>();
TreeIterator<EObject> tIter = eobj.eAllContents();
while (tIter.hasNext()) {
EObject eObj = tIter.next();
EReference eRef = eObj.eContainmentFeature();
if (stopReferencesL != null && stopReferencesL.contains(eRef)) {
tIter.prune();
} else {
if (filterType.isInstance(eObj)) {
contentList.add((T) eObj);
if (findFirst) {
return contentList;
}
}
}
}
return contentList;
}