Java Code Examples for org.eclipse.emf.ecore.EStructuralFeature#setUpperBound()
The following examples show how to use
org.eclipse.emf.ecore.EStructuralFeature#setUpperBound() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EClassifierInfo.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
private EStructuralFeature createFeatureWith(String featureName, EClassifier featureClassifier, boolean isMultivalue, boolean isContainment) { EStructuralFeature newFeature; if (featureClassifier instanceof EClass) { EReference reference = EcoreFactory.eINSTANCE.createEReference(); reference.setContainment(isContainment); newFeature = reference; } else { newFeature = EcoreFactory.eINSTANCE.createEAttribute(); } newFeature.setName(featureName); newFeature.setEType(featureClassifier); newFeature.setLowerBound(0); newFeature.setUpperBound(isMultivalue ? -1 : 1); newFeature.setUnique(!isMultivalue || (isContainment && featureClassifier instanceof EClass)); if (newFeature.getEType() instanceof EEnum) { newFeature.setDefaultValue(null); } return newFeature; }