本文整理匯總了Java中org.eclipse.emf.ecore.EReference.setUpperBound方法的典型用法代碼示例。如果您正苦於以下問題:Java EReference.setUpperBound方法的具體用法?Java EReference.setUpperBound怎麽用?Java EReference.setUpperBound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.EReference
的用法示例。
在下文中一共展示了EReference.setUpperBound方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: completeRecordTypeFeatures
import org.eclipse.emf.ecore.EReference; //導入方法依賴的package包/類
private void completeRecordTypeFeatures(RecordType recordType, EClass type) {
for (RecordField rf : recordType.getRecordFields()) {
// if the type of the recordField is different to arraytype or a recordtype
// it will be translated into a EMF attribute
if (!(rf.getType() instanceof RecordType || rf.getType() instanceof ArrayType)) {
EAttribute attribute = EcoreFactory.eINSTANCE.createEAttribute();
type.getEStructuralFeatures().add(attribute);
attribute.setName(rf.getName());
attribute.setLowerBound(1);
attribute.setEType(getMappedType(rf.getType()));
// Set the default value of the Ecore attribute.
String defaultValue = rf.getDefault();
if (defaultValue != null && !defaultValue.isEmpty()) {
attribute.setDefaultValue(defaultValue);
}
// The Ecore attribute is required when the OCCI attribute is required.
if (attribute.isRequired()) {
attribute.setLowerBound(1);
}
attachInfo(attribute, rf.getDescription());
} else {
// otherwise, il will be translated into an EMF reference
EReference reference = EcoreFactory.eINSTANCE.createEReference();
type.getEStructuralFeatures().add(reference);
reference.setName(rf.getName());
// The Ecore attribute is required when the OCCI attribute is required.
if (rf.isRequired()) {
reference.setLowerBound(1);
}
reference.setUpperBound(1);
reference.setEType(getMappedType(rf.getType()));
reference.setContainment(true);
// Set the default value of the Ecore attribute.
// Default values for EMF EReference is not supported
// see https://www.eclipse.org/forums/index.php?t=msg&th=131049&goto=406266&#msg_406266
// String defaultValue = rf.getDefault();
// if (defaultValue != null && !defaultValue.isEmpty()) {
// reference.setDefaultValue(defaultValue);
// }
attachInfo(reference, rf.getDescription());
}
}
}