當前位置: 首頁>>代碼示例>>Java>>正文


Java EStructuralFeature.getEType方法代碼示例

本文整理匯總了Java中org.eclipse.emf.ecore.EStructuralFeature.getEType方法的典型用法代碼示例。如果您正苦於以下問題:Java EStructuralFeature.getEType方法的具體用法?Java EStructuralFeature.getEType怎麽用?Java EStructuralFeature.getEType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.emf.ecore.EStructuralFeature的用法示例。


在下文中一共展示了EStructuralFeature.getEType方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: decideUseForSerializationList

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
protected void decideUseForSerializationList(VirtualObject object, EStructuralFeature feature, List featureValue)
		throws DatabaseException {
	if (!(feature.getEType() instanceof EClass)) {
		return;
	}
	for (int i = 0; i < featureValue.size(); i++) {
		Object objectInList = featureValue.get(i);
		if (objectInList instanceof List && objectInList instanceof VirtualObject) {
			List twodimensionalarray = (List) objectInList;
			EStructuralFeature twodimensionalarrayFeature = ((EClass) feature.getEType())
					.getEStructuralFeature("List");
			decideUseForSerializationList((VirtualObject) objectInList, twodimensionalarrayFeature,
					twodimensionalarray);
		} else if (feature instanceof EReference && objectInList instanceof Long) {
			EClass referenceClass = getReusable().getCatalogService().getEClassForOid((Long) objectInList);
			if (getQueryObjectProvider().hasReadOrIsGoingToRead(((Long) objectInList)) || getQueryObjectProvider().hasReadOrIsGoingToRead(referenceClass)) {
				object.addUseForSerialization(feature, i);
			}
		}
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:23,代碼來源:RunnableDatabaseReadingStackFrame.java

示例2: readEnum

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void readEnum(String val, VirtualObject object, EStructuralFeature structuralFeature) throws DeserializeException, MetaDataException, DatabaseException {
	if (val.equals(".T.")) {
		object.setAttribute(structuralFeature, Boolean.TRUE);
	} else if (val.equals(".F.")) {
		object.setAttribute(structuralFeature, Boolean.FALSE);
	} else if (val.equals(".U.")) {
		object.eUnset(structuralFeature);
	} else {
		if (structuralFeature.getEType() instanceof EEnumImpl) {
			String realEnumValue = val.substring(1, val.length() - 1);
			EEnumLiteral enumValue = (((EEnumImpl) structuralFeature.getEType()).getEEnumLiteral(realEnumValue));
			if (enumValue == null) {
				throw new DeserializeException(lineNumber, "Enum type " + structuralFeature.getEType().getName() + " has no literal value '" + realEnumValue + "'");
			}
			object.setAttribute(structuralFeature, enumValue.getLiteral());
		} else {
			throw new DeserializeException(lineNumber, "Value " + val + " indicates enum type but " + structuralFeature.getEType().getName() + " expected");
		}
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:21,代碼來源:IfcStepStreamingDeserializer.java

示例3: writeEmbedded

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void writeEmbedded(WrappedVirtualObject eObject) throws SerializerException, IOException {
	print(packageMetaData.getUpperCase(eObject.eClass()));
	print(OPEN_PAREN);
	EStructuralFeature structuralFeature = eObject.eClass().getEStructuralFeature(WRAPPED_VALUE);
	if (structuralFeature != null) {
		Object realVal = eObject.eGet(structuralFeature);
		if (structuralFeature.getEType() == ECORE_PACKAGE_INSTANCE.getEDouble()) {
			EStructuralFeature asStringFeature = eObject.eClass()
					.getEStructuralFeature(structuralFeature.getName() + "AsString");
			String asString = (String) eObject.eGet(asStringFeature);
			writeDoubleValue((Double) realVal, asString, structuralFeature);
		} else {
			IfcParserWriterUtils.writePrimitive(realVal, printWriter);
		}
	}
	print(CLOSE_PAREN);
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:18,代碼來源:IfcStepStreamingSerializer.java

示例4: processObject

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
public void processObject(IdEObject originObject, Map<Integer, IdEObject> result) {
	if (result.containsValue(originObject)) {
		return;
	}
	result.put(originObject.getExpressId(), originObject);
	for (EStructuralFeature feature : originObject.eClass().getEAllStructuralFeatures()) {
		if (getPackageMetaData().useForDatabaseStorage(originObject.eClass(), feature)) {
			if (feature.isMany()) {
				processList(originObject, feature, result);
			} else {
				Object value = originObject.eGet(feature);
				if (feature.getEType() instanceof EClass) {
					if (value != null) {
						IdEObject referencedObject = (IdEObject) value;
						processObject(referencedObject, result);
					}
				} 
			}
		}
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:22,代碼來源:SplitIfcModel.java

示例5: processList

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
public void processList(IdEObject originObject, EStructuralFeature feature, Map<Integer, IdEObject> result) {
	if (result.containsValue(feature)) {
		return;
	}
	if (feature.getEType() instanceof EClass) {
		EList<?> list = (EList<?>) originObject.eGet(feature);
		for (Object o : list) {
			if (o != null) {
				IdEObject listObject = (IdEObject) o;
				if (feature.getEAnnotation("twodimensionalarray") != null) {
					processList(listObject, feature, result);
				} else {
					processObject(listObject, result);
				}
				
			}
		}
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:20,代碼來源:SplitIfcModel.java

示例6: getInitialObjectNames

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
/**
 * Returns the names of the features representing global elements.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected Collection<String> getInitialObjectNames ()
{
    if ( initialObjectNames == null )
    {
        initialObjectNames = new ArrayList<String> ();
        for ( EStructuralFeature eStructuralFeature : ExtendedMetaData.INSTANCE.getAllElements ( ExtendedMetaData.INSTANCE.getDocumentRoot ( configurationPackage ) ) )
        {
            if ( eStructuralFeature.isChangeable () )
            {
                EClassifier eClassifier = eStructuralFeature.getEType ();
                if ( eClassifier instanceof EClass )
                {
                    EClass eClass = (EClass)eClassifier;
                    if ( !eClass.isAbstract () )
                    {
                        initialObjectNames.add ( eStructuralFeature.getName () );
                    }
                }
            }
        }
        Collections.sort ( initialObjectNames, CommonPlugin.INSTANCE.getComparator () );
    }
    return initialObjectNames;
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:31,代碼來源:ConfigurationModelWizard.java

示例7: writeObject

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void writeObject(VirtualObject object, EStructuralFeature feature) throws SerializerException, IOException {
	Object ref = object.eGet(feature);
	if (ref == null || (feature.isUnsettable() && !object.eIsSet(feature))) {
		EClassifier type = feature.getEType();
		if (type instanceof EClass) {
			EStructuralFeature structuralFeature = ((EClass) type).getEStructuralFeature(WRAPPED_VALUE);
			if (structuralFeature != null) {
				String name = structuralFeature.getEType().getName();
				if (name.equals(IFC_BOOLEAN) || name.equals(IFC_LOGICAL)
						|| structuralFeature.getEType() == EcorePackage.eINSTANCE.getEBoolean()) {
					print(BOOLEAN_UNDEFINED);
				} else {
					print(DOLLAR);
				}
			} else {
				print(DOLLAR);
			}
		} else {
			if (type == EcorePackage.eINSTANCE.getEBoolean()) {
				print(BOOLEAN_UNDEFINED);
			} else if (feature.isMany()) {
				print("()");
			} else {
				print(DOLLAR);
			}
		}
	} else {
		if (ref instanceof WrappedVirtualObject) {
			writeEmbedded((WrappedVirtualObject) ref);
		} else if (feature.getEType() == ECORE_PACKAGE_INSTANCE.getEDouble()) {
			EStructuralFeature asStringFeature = object.eClass().getEStructuralFeature(feature.getName() + "AsString");
			String asString = (String) object.eGet(asStringFeature);
			writeDoubleValue((Double) ref, asString, feature);
		} else {
			IfcParserWriterUtils.writePrimitive(ref, printWriter);
		}
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:39,代碼來源:IfcStepStreamingSerializer.java

示例8: comparePrimitives

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private int comparePrimitives(IdEObject o1, IdEObject o2) {
	EClass eClass = o1.eClass();
	EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature("wrappedValue");
	Object val1 = o1.eGet(eStructuralFeature);
	Object val2 = o2.eGet(eStructuralFeature);
	if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEString()) {
		return ((String) val1).compareTo((String) val2);
	} else if (eStructuralFeature.getEType() == EcorePackage.eINSTANCE.getEInt()) {
		return ((Integer) val1).compareTo((Integer) val2);
	} else {
		throw new RuntimeException("ni");
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:14,代碼來源:IfcModel.java

示例9: writeObject

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void writeObject(IdEObject object, EStructuralFeature feature) throws SerializerException, IOException {
	Object ref = object.eGet(feature);
	if (ref == null || (feature.isUnsettable() && !object.eIsSet(feature))) {
		EClassifier type = feature.getEType();
		if (type instanceof EClass) {
			EStructuralFeature structuralFeature = ((EClass) type).getEStructuralFeature(WRAPPED_VALUE);
			if (structuralFeature != null) {
				String name = structuralFeature.getEType().getName();
				if (name.equals(IFC_BOOLEAN) || name.equals(IFC_LOGICAL) || structuralFeature.getEType() == EcorePackage.eINSTANCE.getEBoolean()) {
					print(BOOLEAN_UNDEFINED);
				} else {
					print(DOLLAR);
				}
			} else {
				print(DOLLAR);
			}
		} else {
			if (type == EcorePackage.eINSTANCE.getEBoolean()) {
				print(BOOLEAN_UNDEFINED);
			} else if (feature.isMany()) {
				print("()");
			} else {
				print(DOLLAR);
			}
		}
	} else {
		if (ref instanceof EObject) {
			writeEmbedded((EObject) ref);
		} else if (feature.getEType() == ECORE_PACKAGE_INSTANCE.getEDouble()) {
			writeDoubleValue((Double)ref, object, feature);
		} else {
			IfcParserWriterUtils.writePrimitive(ref, outputStream);
		}
	}
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:36,代碼來源:IfcStepSerializer.java

示例10: writeEmbedded

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void writeEmbedded(EObject eObject) throws SerializerException, IOException {
	EClass class1 = eObject.eClass();
	print(getPackageMetaData().getUpperCase(class1));
	print(OPEN_PAREN);
	EStructuralFeature structuralFeature = class1.getEStructuralFeature(WRAPPED_VALUE);
	if (structuralFeature != null) {
		Object realVal = eObject.eGet(structuralFeature);
		if (structuralFeature.getEType() == ECORE_PACKAGE_INSTANCE.getEDouble()) {
			writeDoubleValue((Double)realVal, eObject, structuralFeature);
		} else {
			IfcParserWriterUtils.writePrimitive(realVal, outputStream);
		}
	}
	print(CLOSE_PAREN);
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:16,代碼來源:IfcStepSerializer.java

示例11: readList

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private boolean readList(String val, VirtualObject object, EStructuralFeature structuralFeature) throws DeserializeException, MetaDataException, DatabaseException {
		int index = 0;
		if (!structuralFeature.isMany()) {
			throw new DeserializeException(lineNumber, "Field " + structuralFeature.getName() + " of " + structuralFeature.getEContainingClass().getName() + " is no aggregation");
		}
		boolean isDouble = structuralFeature.getEType() == EcorePackage.eINSTANCE.getEDouble();
		EStructuralFeature doubleStringFeature = null;
		if (isDouble) {
			doubleStringFeature = structuralFeature.getEContainingClass().getEStructuralFeature(structuralFeature.getName() + "AsString");
			if (doubleStringFeature == null) {//linfujun, i change the code here to fix the bug
				doubleStringFeature = structuralFeature.getEContainingClass().getEStructuralFeature(structuralFeature.getFeatureID());
			}
			if (doubleStringFeature == null) {
				throw new DeserializeException(lineNumber, "Field not found: " + structuralFeature.getName() + "AsString");
			}
		}
		String realData = val.substring(1, val.length() - 1);
		int lastIndex = 0;
//		object.startList(structuralFeature);
		// TODO not always instantiate
		List<String> doubles = new ArrayList<>();
		boolean complete = true;
		while (lastIndex != realData.length() + 1) {
			int nextIndex = StringUtils.nextString(realData, lastIndex);
			String stringValue = realData.substring(lastIndex, nextIndex - 1).trim();
			lastIndex = nextIndex;
			if (stringValue.length() > 0) {
				if (stringValue.charAt(0) == '#') {
					Integer referenceId = Integer.parseInt(stringValue.substring(1));
					if (mappedObjects.containsKey(referenceId)) {
						Long referencedOid = mappedObjects.get(referenceId);
						if (referencedOid != null) {
							EClass referenceEClass = catalogService.getEClassForOid(referencedOid);
							if (((EClass) structuralFeature.getEType()).isSuperTypeOf(referenceEClass)) {
								// TODO unique checking?
								object.setListItemReference(structuralFeature, index, referencedOid);
							} else {
								throw new DeserializeException(lineNumber, referenceEClass.getName() + " cannot be stored in " + structuralFeature.getName());
							}
						}
					} else {
//						int pos = object.reserveSpaceForListReference();
						waitingList.add(referenceId, new ListWaitingVirtualObject(lineNumber, object, structuralFeature, index));
						complete = false;
					}
				} else if (stringValue.charAt(0) == '(') {
					// Two dimensional list
					EClass newObjectEClass = (EClass) structuralFeature.getEType();
					VirtualObject newObject = newVirtualObject((EClass) structuralFeature.getEType());
					readList(stringValue, newObject, newObjectEClass.getEStructuralFeature("List"));
					// TODO unique?
					object.setListItemReference(structuralFeature, index, newObject.getOid());
				} else {
					Object convert = convert(structuralFeature.getEType(), stringValue);
					if (convert != null) {
						object.setListItem(structuralFeature, index, convert);
						if (isDouble) {
							doubles.add(stringValue);
						}
					}
				}
			}
			index++;
		}
//		object.endList();
		// TODO make more efficient
		if (isDouble) {
//			object.startList(doubleStringFeature);
			int i=0;
			for (String d : doubles) {
				if (doubleStringFeature.getEType() == EcorePackage.eINSTANCE.getEDouble()) {//linfujun, i change the code here to fix the bug
					object.setListItem(doubleStringFeature, i++, Double.parseDouble(d));
				} else {
					object.setListItem(doubleStringFeature, i++, d);
				}
			}
//			object.endList();
		}
		return complete;
	}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:81,代碼來源:IfcStepStreamingDeserializer.java

示例12: write

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void write(VirtualObject object) throws SerializerException, IOException {
	if (object.eClass().getEAnnotation("hidden") != null) {
		return;
	}
	print(DASH);
	int convertedKey = getExpressId(object);
	if (convertedKey == -1) {
		throw new SerializerException("Going to serialize an object with id -1 (" + object.eClass().getName() + ")");
	}
	print(String.valueOf(convertedKey));
	print("= ");
	String upperCase = packageMetaData.getUpperCase(object.eClass());
	if (upperCase == null) {
		throw new SerializerException("Type not found: " + object.eClass().getName());
	}
	print(upperCase);
	print(OPEN_PAREN);
	boolean isFirst = true;

	EntityDefinition entityBN = getSchemaDefinition().getEntityBN(object.eClass().getName());
	for (EStructuralFeature feature : object.eClass().getEAllStructuralFeatures()) {
		if (feature.getEAnnotation("hidden") == null && (entityBN != null
				&& (!entityBN.isDerived(feature.getName()) || entityBN.isDerivedOverride(feature.getName())))) {
			EClassifier type = feature.getEType();
			if (type instanceof EEnum) {
				if (!isFirst) {
					print(COMMA);
				}
				writeEnum(object, feature);
				isFirst = false;
			} else if (type instanceof EClass) {
				EReference eReference = (EReference) feature;
				if (!packageMetaData.isInverse(eReference)) {
					if (!isFirst) {
						print(COMMA);
					}
					writeEClass(object, feature);
					isFirst = false;
				}
			} else if (type instanceof EDataType) {
				if (!isFirst) {
					print(COMMA);
				}
				writeEDataType(object, entityBN, feature);
				isFirst = false;
			}
		}
	}
	println(PAREN_CLOSE_SEMICOLON);
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:51,代碼來源:IfcStepStreamingSerializer.java

示例13: write

import org.eclipse.emf.ecore.EStructuralFeature; //導入方法依賴的package包/類
private void write(IdEObject object) throws SerializerException, IOException {
	EClass eClass = object.eClass();
	if (eClass.getEAnnotation("hidden") != null) {
		return;
	}
	print(DASH);
	int convertedKey = getExpressId(object);
	if (convertedKey == -1) {
		throw new SerializerException("Going to serialize an object with id -1 (" + object.eClass().getName() + ")");
	}
	print(String.valueOf(convertedKey));
	print("= ");
	String upperCase = getPackageMetaData().getUpperCase(eClass);
	if (upperCase == null) {
		throw new SerializerException("Type not found: " + eClass.getName());
	}
	print(upperCase);
	print(OPEN_PAREN);
	boolean isFirst = true;
	EntityDefinition entityBN = getPackageMetaData().getSchemaDefinition().getEntityBN(object.eClass().getName());
	for (EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
		if (feature.getEAnnotation("hidden") == null && (entityBN != null && (!entityBN.isDerived(feature.getName()) || entityBN.isDerivedOverride(feature.getName())))) {
			EClassifier type = feature.getEType();
			if (type instanceof EEnum) {
				if (!isFirst) {
					print(COMMA);
				}
				writeEnum(object, feature);
				isFirst = false;
			} else if (type instanceof EClass) {
				EReference eReference = (EReference)feature;
				if (!getPackageMetaData().isInverse(eReference)) {
					if (!isFirst) {
						print(COMMA);
					}
					writeEClass(object, feature);
					isFirst = false;
				}
			} else if (type instanceof EDataType) {
				if (!isFirst) {
					print(COMMA);
				}
				writeEDataType(object, entityBN, feature);
				isFirst = false;
			}
		}
	}
	println(PAREN_CLOSE_SEMICOLON);
}
 
開發者ID:shenan4321,項目名稱:BIMplatform,代碼行數:50,代碼來源:IfcStepSerializer.java


注:本文中的org.eclipse.emf.ecore.EStructuralFeature.getEType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。