本文整理匯總了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;
}