diff options
author | Eike Stepper | 2012-04-28 06:16:56 +0000 |
---|---|---|
committer | Eike Stepper | 2012-04-28 06:16:56 +0000 |
commit | 04b8926936d7d4fdc1351b4365db6d703a07f7ab (patch) | |
tree | 98586b52b529dc262beebf0bbf2f1818b13dcc02 /plugins/org.eclipse.emf.cdo.tests.model6 | |
parent | b2ecb73b5a7b3474552c27757559b0f8f8630ba5 (diff) | |
download | cdo-04b8926936d7d4fdc1351b4365db6d703a07f7ab.tar.gz cdo-04b8926936d7d4fdc1351b4365db6d703a07f7ab.tar.xz cdo-04b8926936d7d4fdc1351b4365db6d703a07f7ab.zip |
[322218] ClassCastException adding an object to an EList with objects of a custom data type
https://bugs.eclipse.org/bugs/show_bug.cgi?id=322218
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests.model6')
17 files changed, 1566 insertions, 44 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/model/model6.ecore b/plugins/org.eclipse.emf.cdo.tests.model6/model/model6.ecore index d58bd20d76..6b7244f34e 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/model/model6.ecore +++ b/plugins/org.eclipse.emf.cdo.tests.model6/model/model6.ecore @@ -86,4 +86,18 @@ eType="#//BaseObject"/> <eStructuralFeatures xsi:type="ecore:EReference" name="list" upperBound="-1" eType="#//BaseObject"/> </eClassifiers> + <eClassifiers xsi:type="ecore:EEnum" name="MyEnum"> + <eLiterals name="ZERO"/> + <eLiterals name="ONE" value="1"/> + <eLiterals name="TWO" value="2"/> + <eLiterals name="THREE" value="3"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="MyEnumList"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="myEnum" upperBound="-1" + eType="#//MyEnum"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="MyEnumListUnsettable"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="myEnum" upperBound="-1" + eType="#//MyEnum" unsettable="true"/> + </eClassifiers> </ecore:EPackage> diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/GImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/GImpl.java index 0919d46f83..5c3288763e 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/GImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/GImpl.java @@ -148,9 +148,7 @@ public class GImpl extends EObjectImpl implements G String oldDummy = dummy; dummy = newDummy; if (eNotificationRequired()) - { eNotify(new ENotificationImpl(this, Notification.SET, Model6Package.G__DUMMY, oldDummy, dummy)); - } } /** @@ -167,9 +165,7 @@ public class GImpl extends EObjectImpl implements G if (reference != oldReference) { if (eNotificationRequired()) - { eNotify(new ENotificationImpl(this, Notification.RESOLVE, Model6Package.G__REFERENCE, oldReference, reference)); - } } } return reference; @@ -195,9 +191,7 @@ public class GImpl extends EObjectImpl implements G BaseObject oldReference = reference; reference = newReference; if (eNotificationRequired()) - { eNotify(new ENotificationImpl(this, Notification.SET, Model6Package.G__REFERENCE, oldReference, reference)); - } } /** @@ -258,9 +252,7 @@ public class GImpl extends EObjectImpl implements G return getDummy(); case Model6Package.G__REFERENCE: if (resolve) - { return getReference(); - } return basicGetReference(); case Model6Package.G__LIST: return getList(); @@ -345,9 +337,7 @@ public class GImpl extends EObjectImpl implements G public String toString() { if (eIsProxy()) - { return super.toString(); - } StringBuffer result = new StringBuffer(super.toString()); result.append(" (dummy: "); diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6FactoryImpl.java index 04993a4c10..19ac24dba8 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6FactoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6FactoryImpl.java @@ -21,6 +21,9 @@ import org.eclipse.emf.cdo.tests.model6.D; import org.eclipse.emf.cdo.tests.model6.E; import org.eclipse.emf.cdo.tests.model6.F; import org.eclipse.emf.cdo.tests.model6.G; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; import org.eclipse.emf.cdo.tests.model6.PropertiesMap; import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue; import org.eclipse.emf.cdo.tests.model6.ReferenceObject; @@ -28,6 +31,7 @@ import org.eclipse.emf.cdo.tests.model6.Root; import org.eclipse.emf.cdo.tests.model6.UnorderedList; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; @@ -113,12 +117,50 @@ public class Model6FactoryImpl extends EFactoryImpl implements Model6Factory return createF(); case Model6Package.G: return createG(); + case Model6Package.MY_ENUM_LIST: + return createMyEnumList(); + case Model6Package.MY_ENUM_LIST_UNSETTABLE: + return createMyEnumListUnsettable(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { + case Model6Package.MY_ENUM: + return createMyEnumFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { + case Model6Package.MY_ENUM: + return convertMyEnumToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @@ -273,6 +315,52 @@ public class Model6FactoryImpl extends EFactoryImpl implements Model6Factory } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MyEnumList createMyEnumList() + { + MyEnumListImpl myEnumList = new MyEnumListImpl(); + return myEnumList; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MyEnumListUnsettable createMyEnumListUnsettable() + { + MyEnumListUnsettableImpl myEnumListUnsettable = new MyEnumListUnsettableImpl(); + return myEnumListUnsettable; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MyEnum createMyEnumFromString(EDataType eDataType, String initialValue) + { + MyEnum result = MyEnum.get(initialValue); + if (result == null) + throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + + eDataType.getName() + "'"); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertMyEnumToString(EDataType eDataType, Object instanceValue) + { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6PackageImpl.java index 9c7fccd386..d887d55013 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/Model6PackageImpl.java @@ -21,6 +21,9 @@ import org.eclipse.emf.cdo.tests.model6.D; import org.eclipse.emf.cdo.tests.model6.E; import org.eclipse.emf.cdo.tests.model6.F; import org.eclipse.emf.cdo.tests.model6.G; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; import org.eclipse.emf.cdo.tests.model6.PropertiesMap; import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue; import org.eclipse.emf.cdo.tests.model6.ReferenceObject; @@ -29,6 +32,7 @@ import org.eclipse.emf.cdo.tests.model6.UnorderedList; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; @@ -136,6 +140,27 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package private EClass gEClass = null; /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass myEnumListEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass myEnumListUnsettableEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EEnum myEnumEEnum = null; + + /** * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry * EPackage.Registry} by the package package URI value. * <p> @@ -599,6 +624,56 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMyEnumList() + { + return myEnumListEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getMyEnumList_MyEnum() + { + return (EAttribute)myEnumListEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMyEnumListUnsettable() + { + return myEnumListUnsettableEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getMyEnumListUnsettable_MyEnum() + { + return (EAttribute)myEnumListUnsettableEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EEnum getMyEnum() + { + return myEnumEEnum; + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @@ -685,6 +760,15 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package createEAttribute(gEClass, G__DUMMY); createEReference(gEClass, G__REFERENCE); createEReference(gEClass, G__LIST); + + myEnumListEClass = createEClass(MY_ENUM_LIST); + createEAttribute(myEnumListEClass, MY_ENUM_LIST__MY_ENUM); + + myEnumListUnsettableEClass = createEClass(MY_ENUM_LIST_UNSETTABLE); + createEAttribute(myEnumListUnsettableEClass, MY_ENUM_LIST_UNSETTABLE__MY_ENUM); + + // Create enums + myEnumEEnum = createEEnum(MY_ENUM); } /** @@ -839,6 +923,23 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package addEOperation(gEClass, ecorePackage.getEBoolean(), "isListModified", 1, 1, IS_UNIQUE, IS_ORDERED); + initEClass(myEnumListEClass, MyEnumList.class, "MyEnumList", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getMyEnumList_MyEnum(), getMyEnum(), "myEnum", null, 0, -1, MyEnumList.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(myEnumListUnsettableEClass, MyEnumListUnsettable.class, "MyEnumListUnsettable", !IS_ABSTRACT, + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getMyEnumListUnsettable_MyEnum(), getMyEnum(), "myEnum", null, 0, -1, MyEnumListUnsettable.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(myEnumEEnum, MyEnum.class, "MyEnum"); + addEEnumLiteral(myEnumEEnum, MyEnum.ZERO); + addEEnumLiteral(myEnumEEnum, MyEnum.ONE); + addEEnumLiteral(myEnumEEnum, MyEnum.TWO); + addEEnumLiteral(myEnumEEnum, MyEnum.THREE); + // Create resource createResource(eNS_URI); } diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/MyEnumListImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/MyEnumListImpl.java new file mode 100644 index 0000000000..fb2bc23625 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/MyEnumListImpl.java @@ -0,0 +1,162 @@ +/** + */ +package org.eclipse.emf.cdo.tests.legacy.model6.impl; + +import org.eclipse.emf.cdo.tests.legacy.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; + +import java.util.Collection; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>My Enum List</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.legacy.model6.impl.MyEnumListImpl#getMyEnum <em>My Enum</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MyEnumListImpl extends EObjectImpl implements MyEnumList +{ + /** + * The cached value of the '{@link #getMyEnum() <em>My Enum</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMyEnum() + * @generated + * @ordered + */ + protected EList<MyEnum> myEnum; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MyEnumListImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Model6Package.eINSTANCE.getMyEnumList(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<MyEnum> getMyEnum() + { + if (myEnum == null) + { + myEnum = new EDataTypeUniqueEList<MyEnum>(MyEnum.class, this, Model6Package.MY_ENUM_LIST__MY_ENUM); + } + return myEnum; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST__MY_ENUM: + return getMyEnum(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST__MY_ENUM: + getMyEnum().clear(); + getMyEnum().addAll((Collection<? extends MyEnum>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST__MY_ENUM: + getMyEnum().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST__MY_ENUM: + return myEnum != null && !myEnum.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + if (eIsProxy()) + return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (myEnum: "); + result.append(myEnum); + result.append(')'); + return result.toString(); + } + +} //MyEnumListImpl diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/MyEnumListUnsettableImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/MyEnumListUnsettableImpl.java new file mode 100644 index 0000000000..aaf21455a9 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/legacy/model6/impl/MyEnumListUnsettableImpl.java @@ -0,0 +1,185 @@ +/** + */ +package org.eclipse.emf.cdo.tests.legacy.model6.impl; + +import org.eclipse.emf.cdo.tests.legacy.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import java.util.Collection; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>My Enum List Unsettable</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.legacy.model6.impl.MyEnumListUnsettableImpl#getMyEnum <em>My Enum</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MyEnumListUnsettableImpl extends EObjectImpl implements MyEnumListUnsettable +{ + /** + * The cached value of the '{@link #getMyEnum() <em>My Enum</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getMyEnum() + * @generated + * @ordered + */ + protected EList<MyEnum> myEnum; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MyEnumListUnsettableImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Model6Package.eINSTANCE.getMyEnumListUnsettable(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList<MyEnum> getMyEnum() + { + if (myEnum == null) + { + myEnum = new EDataTypeUniqueEList.Unsettable<MyEnum>(MyEnum.class, this, + Model6Package.MY_ENUM_LIST_UNSETTABLE__MY_ENUM); + } + return myEnum; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetMyEnum() + { + if (myEnum != null) + ((InternalEList.Unsettable<?>)myEnum).unset(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetMyEnum() + { + return myEnum != null && ((InternalEList.Unsettable<?>)myEnum).isSet(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST_UNSETTABLE__MY_ENUM: + return getMyEnum(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST_UNSETTABLE__MY_ENUM: + getMyEnum().clear(); + getMyEnum().addAll((Collection<? extends MyEnum>)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST_UNSETTABLE__MY_ENUM: + unsetMyEnum(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case Model6Package.MY_ENUM_LIST_UNSETTABLE__MY_ENUM: + return isSetMyEnum(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + if (eIsProxy()) + return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (myEnum: "); + result.append(myEnum); + result.append(')'); + return result.toString(); + } + +} //MyEnumListUnsettableImpl diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Factory.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Factory.java index a34bb12c71..c9836cda52 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Factory.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Factory.java @@ -143,6 +143,24 @@ public interface Model6Factory extends EFactory G createG(); /** + * Returns a new object of class '<em>My Enum List</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>My Enum List</em>'. + * @generated + */ + MyEnumList createMyEnumList(); + + /** + * Returns a new object of class '<em>My Enum List Unsettable</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>My Enum List Unsettable</em>'. + * @generated + */ + MyEnumListUnsettable createMyEnumListUnsettable(); + + /** * Returns the package supported by this factory. * <!-- begin-user-doc --> <!-- end-user-doc --> * @return the package supported by this factory. diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Package.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Package.java index e308d5ea3b..8f1902c4f4 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Package.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/Model6Package.java @@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.tests.model6; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -637,6 +638,72 @@ public interface Model6Package extends EPackage int G_FEATURE_COUNT = 3; /** + * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model6.impl.MyEnumListImpl <em>My Enum List</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.impl.MyEnumListImpl + * @see org.eclipse.emf.cdo.tests.model6.impl.Model6PackageImpl#getMyEnumList() + * @generated + */ + int MY_ENUM_LIST = 15; + + /** + * The feature id for the '<em><b>My Enum</b></em>' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MY_ENUM_LIST__MY_ENUM = 0; + + /** + * The number of structural features of the '<em>My Enum List</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MY_ENUM_LIST_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model6.impl.MyEnumListUnsettableImpl <em>My Enum List Unsettable</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.impl.MyEnumListUnsettableImpl + * @see org.eclipse.emf.cdo.tests.model6.impl.Model6PackageImpl#getMyEnumListUnsettable() + * @generated + */ + int MY_ENUM_LIST_UNSETTABLE = 16; + + /** + * The feature id for the '<em><b>My Enum</b></em>' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MY_ENUM_LIST_UNSETTABLE__MY_ENUM = 0; + + /** + * The number of structural features of the '<em>My Enum List Unsettable</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int MY_ENUM_LIST_UNSETTABLE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.tests.model6.MyEnum <em>My Enum</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.MyEnum + * @see org.eclipse.emf.cdo.tests.model6.impl.Model6PackageImpl#getMyEnum() + * @generated + */ + int MY_ENUM = 17; + + /** * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model6.Root <em>Root</em>}'. <!-- * begin-user-doc --> <!-- end-user-doc --> * @@ -1084,6 +1151,58 @@ public interface Model6Package extends EPackage EReference getG_List(); /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model6.MyEnumList <em>My Enum List</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>My Enum List</em>'. + * @see org.eclipse.emf.cdo.tests.model6.MyEnumList + * @generated + */ + EClass getMyEnumList(); + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.tests.model6.MyEnumList#getMyEnum <em>My Enum</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute list '<em>My Enum</em>'. + * @see org.eclipse.emf.cdo.tests.model6.MyEnumList#getMyEnum() + * @see #getMyEnumList() + * @generated + */ + EAttribute getMyEnumList_MyEnum(); + + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable <em>My Enum List Unsettable</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>My Enum List Unsettable</em>'. + * @see org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable + * @generated + */ + EClass getMyEnumListUnsettable(); + + /** + * Returns the meta object for the attribute list '{@link org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable#getMyEnum <em>My Enum</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute list '<em>My Enum</em>'. + * @see org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable#getMyEnum() + * @see #getMyEnumListUnsettable() + * @generated + */ + EAttribute getMyEnumListUnsettable_MyEnum(); + + /** + * Returns the meta object for enum '{@link org.eclipse.emf.cdo.tests.model6.MyEnum <em>My Enum</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for enum '<em>My Enum</em>'. + * @see org.eclipse.emf.cdo.tests.model6.MyEnum + * @generated + */ + EEnum getMyEnum(); + + /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> <!-- end-user-doc --> * @return the factory that creates the instances of the model. @@ -1473,6 +1592,52 @@ public interface Model6Package extends EPackage */ EReference G__LIST = eINSTANCE.getG_List(); + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model6.impl.MyEnumListImpl <em>My Enum List</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.impl.MyEnumListImpl + * @see org.eclipse.emf.cdo.tests.model6.impl.Model6PackageImpl#getMyEnumList() + * @generated + */ + EClass MY_ENUM_LIST = eINSTANCE.getMyEnumList(); + + /** + * The meta object literal for the '<em><b>My Enum</b></em>' attribute list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute MY_ENUM_LIST__MY_ENUM = eINSTANCE.getMyEnumList_MyEnum(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model6.impl.MyEnumListUnsettableImpl <em>My Enum List Unsettable</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.impl.MyEnumListUnsettableImpl + * @see org.eclipse.emf.cdo.tests.model6.impl.Model6PackageImpl#getMyEnumListUnsettable() + * @generated + */ + EClass MY_ENUM_LIST_UNSETTABLE = eINSTANCE.getMyEnumListUnsettable(); + + /** + * The meta object literal for the '<em><b>My Enum</b></em>' attribute list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute MY_ENUM_LIST_UNSETTABLE__MY_ENUM = eINSTANCE.getMyEnumListUnsettable_MyEnum(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.tests.model6.MyEnum <em>My Enum</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.MyEnum + * @see org.eclipse.emf.cdo.tests.model6.impl.Model6PackageImpl#getMyEnum() + * @generated + */ + EEnum MY_ENUM = eINSTANCE.getMyEnum(); + } } // Model6Package diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnum.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnum.java new file mode 100644 index 0000000000..0d6527b749 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnum.java @@ -0,0 +1,274 @@ +/** + */ +package org.eclipse.emf.cdo.tests.model6; + +import org.eclipse.emf.common.util.Enumerator; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * <!-- begin-user-doc --> + * A representation of the literals of the enumeration '<em><b>My Enum</b></em>', + * and utility methods for working with them. + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.tests.model6.Model6Package#getMyEnum() + * @model + * @generated + */ +public enum MyEnum implements Enumerator +{ + /** + * The '<em><b>ZERO</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #ZERO_VALUE + * @generated + * @ordered + */ + ZERO(0, "ZERO", "ZERO"), + + /** + * The '<em><b>ONE</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #ONE_VALUE + * @generated + * @ordered + */ + ONE(1, "ONE", "ONE"), + + /** + * The '<em><b>TWO</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #TWO_VALUE + * @generated + * @ordered + */ + TWO(2, "TWO", "TWO"), + + /** + * The '<em><b>THREE</b></em>' literal object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #THREE_VALUE + * @generated + * @ordered + */ + THREE(3, "THREE", "THREE"); + + /** + * The '<em><b>ZERO</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>ZERO</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #ZERO + * @model + * @generated + * @ordered + */ + public static final int ZERO_VALUE = 0; + + /** + * The '<em><b>ONE</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>ONE</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #ONE + * @model + * @generated + * @ordered + */ + public static final int ONE_VALUE = 1; + + /** + * The '<em><b>TWO</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>TWO</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #TWO + * @model + * @generated + * @ordered + */ + public static final int TWO_VALUE = 2; + + /** + * The '<em><b>THREE</b></em>' literal value. + * <!-- begin-user-doc --> + * <p> + * If the meaning of '<em><b>THREE</b></em>' literal object isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @see #THREE + * @model + * @generated + * @ordered + */ + public static final int THREE_VALUE = 3; + + /** + * An array of all the '<em><b>My Enum</b></em>' enumerators. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static final MyEnum[] VALUES_ARRAY = new MyEnum[] { ZERO, ONE, TWO, THREE, }; + + /** + * A public read-only list of all the '<em><b>My Enum</b></em>' enumerators. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static final List<MyEnum> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the '<em><b>My Enum</b></em>' literal with the specified literal value. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static MyEnum get(String literal) + { + for (int i = 0; i < VALUES_ARRAY.length; ++i) + { + MyEnum result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) + { + return result; + } + } + return null; + } + + /** + * Returns the '<em><b>My Enum</b></em>' literal with the specified name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static MyEnum getByName(String name) + { + for (int i = 0; i < VALUES_ARRAY.length; ++i) + { + MyEnum result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) + { + return result; + } + } + return null; + } + + /** + * Returns the '<em><b>My Enum</b></em>' literal with the specified integer value. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static MyEnum get(int value) + { + switch (value) + { + case ZERO_VALUE: + return ZERO; + case ONE_VALUE: + return ONE; + case TWO_VALUE: + return TWO; + case THREE_VALUE: + return THREE; + } + return null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final int value; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final String name; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private MyEnum(int value, String name, String literal) + { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getValue() + { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getName() + { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getLiteral() + { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + return literal; + } + +} //MyEnum diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnumList.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnumList.java new file mode 100644 index 0000000000..a19960033f --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnumList.java @@ -0,0 +1,44 @@ +/** + */ +package org.eclipse.emf.cdo.tests.model6; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>My Enum List</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.model6.MyEnumList#getMyEnum <em>My Enum</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.cdo.tests.model6.Model6Package#getMyEnumList() + * @model + * @generated + */ +public interface MyEnumList extends EObject +{ + /** + * Returns the value of the '<em><b>My Enum</b></em>' attribute list. + * The list contents are of type {@link org.eclipse.emf.cdo.tests.model6.MyEnum}. + * The literals are from the enumeration {@link org.eclipse.emf.cdo.tests.model6.MyEnum}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>My Enum</em>' attribute list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>My Enum</em>' attribute list. + * @see org.eclipse.emf.cdo.tests.model6.MyEnum + * @see org.eclipse.emf.cdo.tests.model6.Model6Package#getMyEnumList_MyEnum() + * @model + * @generated + */ + EList<MyEnum> getMyEnum(); + +} // MyEnumList diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnumListUnsettable.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnumListUnsettable.java new file mode 100644 index 0000000000..47c12c8a20 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/MyEnumListUnsettable.java @@ -0,0 +1,67 @@ +/** + */ +package org.eclipse.emf.cdo.tests.model6; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>My Enum List Unsettable</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable#getMyEnum <em>My Enum</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.cdo.tests.model6.Model6Package#getMyEnumListUnsettable() + * @model + * @generated + */ +public interface MyEnumListUnsettable extends EObject +{ + /** + * Returns the value of the '<em><b>My Enum</b></em>' attribute list. + * The list contents are of type {@link org.eclipse.emf.cdo.tests.model6.MyEnum}. + * The literals are from the enumeration {@link org.eclipse.emf.cdo.tests.model6.MyEnum}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>My Enum</em>' attribute list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>My Enum</em>' attribute list. + * @see org.eclipse.emf.cdo.tests.model6.MyEnum + * @see #isSetMyEnum() + * @see #unsetMyEnum() + * @see org.eclipse.emf.cdo.tests.model6.Model6Package#getMyEnumListUnsettable_MyEnum() + * @model unsettable="true" + * @generated + */ + EList<MyEnum> getMyEnum(); + + /** + * Unsets the value of the '{@link org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable#getMyEnum <em>My Enum</em>}' attribute list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #isSetMyEnum() + * @see #getMyEnum() + * @generated + */ + void unsetMyEnum(); + + /** + * Returns whether the value of the '{@link org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable#getMyEnum <em>My Enum</em>}' attribute list is set. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return whether the value of the '<em>My Enum</em>' attribute list is set. + * @see #unsetMyEnum() + * @see #getMyEnum() + * @generated + */ + boolean isSetMyEnum(); + +} // MyEnumListUnsettable diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6FactoryImpl.java index f15d118efb..002fbb21d0 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6FactoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6FactoryImpl.java @@ -21,6 +21,9 @@ import org.eclipse.emf.cdo.tests.model6.F; import org.eclipse.emf.cdo.tests.model6.G; import org.eclipse.emf.cdo.tests.model6.Model6Factory; import org.eclipse.emf.cdo.tests.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; import org.eclipse.emf.cdo.tests.model6.PropertiesMap; import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue; import org.eclipse.emf.cdo.tests.model6.ReferenceObject; @@ -28,6 +31,7 @@ import org.eclipse.emf.cdo.tests.model6.Root; import org.eclipse.emf.cdo.tests.model6.UnorderedList; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; @@ -115,12 +119,50 @@ public class Model6FactoryImpl extends EFactoryImpl implements Model6Factory return createF(); case Model6Package.G: return createG(); + case Model6Package.MY_ENUM_LIST: + return createMyEnumList(); + case Model6Package.MY_ENUM_LIST_UNSETTABLE: + return createMyEnumListUnsettable(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) + { + switch (eDataType.getClassifierID()) + { + case Model6Package.MY_ENUM: + return createMyEnumFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) + { + switch (eDataType.getClassifierID()) + { + case Model6Package.MY_ENUM: + return convertMyEnumToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @@ -275,6 +317,52 @@ public class Model6FactoryImpl extends EFactoryImpl implements Model6Factory } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MyEnumList createMyEnumList() + { + MyEnumListImpl myEnumList = new MyEnumListImpl(); + return myEnumList; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MyEnumListUnsettable createMyEnumListUnsettable() + { + MyEnumListUnsettableImpl myEnumListUnsettable = new MyEnumListUnsettableImpl(); + return myEnumListUnsettable; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public MyEnum createMyEnumFromString(EDataType eDataType, String initialValue) + { + MyEnum result = MyEnum.get(initialValue); + if (result == null) + throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + + eDataType.getName() + "'"); + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertMyEnumToString(EDataType eDataType, Object instanceValue) + { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6PackageImpl.java index 6d2e6fae7d..eae9baaf45 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/Model6PackageImpl.java @@ -14,6 +14,9 @@ import org.eclipse.emf.cdo.tests.model6.BaseObject; import org.eclipse.emf.cdo.tests.model6.ContainmentObject; import org.eclipse.emf.cdo.tests.model6.Model6Factory; import org.eclipse.emf.cdo.tests.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; import org.eclipse.emf.cdo.tests.model6.PropertiesMap; import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue; import org.eclipse.emf.cdo.tests.model6.ReferenceObject; @@ -22,6 +25,7 @@ import org.eclipse.emf.cdo.tests.model6.UnorderedList; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; @@ -129,6 +133,27 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package private EClass gEClass = null; /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass myEnumListEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass myEnumListUnsettableEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EEnum myEnumEEnum = null; + + /** * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry * EPackage.Registry} by the package package URI value. * <p> @@ -590,6 +615,56 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package } /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMyEnumList() + { + return myEnumListEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getMyEnumList_MyEnum() + { + return (EAttribute)myEnumListEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getMyEnumListUnsettable() + { + return myEnumListUnsettableEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getMyEnumListUnsettable_MyEnum() + { + return (EAttribute)myEnumListUnsettableEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EEnum getMyEnum() + { + return myEnumEEnum; + } + + /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @@ -674,6 +749,15 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package createEAttribute(gEClass, G__DUMMY); createEReference(gEClass, G__REFERENCE); createEReference(gEClass, G__LIST); + + myEnumListEClass = createEClass(MY_ENUM_LIST); + createEAttribute(myEnumListEClass, MY_ENUM_LIST__MY_ENUM); + + myEnumListUnsettableEClass = createEClass(MY_ENUM_LIST_UNSETTABLE); + createEAttribute(myEnumListUnsettableEClass, MY_ENUM_LIST_UNSETTABLE__MY_ENUM); + + // Create enums + myEnumEEnum = createEEnum(MY_ENUM); } /** @@ -840,6 +924,24 @@ public class Model6PackageImpl extends EPackageImpl implements Model6Package addEOperation(gEClass, ecorePackage.getEBoolean(), "isListModified", 1, 1, IS_UNIQUE, IS_ORDERED); + initEClass(myEnumListEClass, MyEnumList.class, "MyEnumList", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getMyEnumList_MyEnum(), this.getMyEnum(), "myEnum", null, 0, -1, MyEnumList.class, !IS_TRANSIENT, + !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(myEnumListUnsettableEClass, MyEnumListUnsettable.class, "MyEnumListUnsettable", !IS_ABSTRACT, + !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getMyEnumListUnsettable_MyEnum(), this.getMyEnum(), "myEnum", null, 0, -1, + MyEnumListUnsettable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, + !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(myEnumEEnum, MyEnum.class, "MyEnum"); + addEEnumLiteral(myEnumEEnum, MyEnum.ZERO); + addEEnumLiteral(myEnumEEnum, MyEnum.ONE); + addEEnumLiteral(myEnumEEnum, MyEnum.TWO); + addEEnumLiteral(myEnumEEnum, MyEnum.THREE); + // Create resource createResource(eNS_URI); } diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/MyEnumListImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/MyEnumListImpl.java new file mode 100644 index 0000000000..d0b421379f --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/MyEnumListImpl.java @@ -0,0 +1,72 @@ +/** + */ +package org.eclipse.emf.cdo.tests.model6.impl; + +import org.eclipse.emf.cdo.tests.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; + +import org.eclipse.emf.internal.cdo.CDOObjectImpl; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>My Enum List</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.model6.impl.MyEnumListImpl#getMyEnum <em>My Enum</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MyEnumListImpl extends CDOObjectImpl implements MyEnumList +{ + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MyEnumListImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Model6Package.Literals.MY_ENUM_LIST; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected int eStaticFeatureCount() + { + return 0; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + public EList<MyEnum> getMyEnum() + { + return (EList<MyEnum>)eGet(Model6Package.Literals.MY_ENUM_LIST__MY_ENUM, true); + } + +} //MyEnumListImpl diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/MyEnumListUnsettableImpl.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/MyEnumListUnsettableImpl.java new file mode 100644 index 0000000000..673b2e53f5 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/impl/MyEnumListUnsettableImpl.java @@ -0,0 +1,92 @@ +/** + */ +package org.eclipse.emf.cdo.tests.model6.impl; + +import org.eclipse.emf.cdo.tests.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnum; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; + +import org.eclipse.emf.internal.cdo.CDOObjectImpl; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>My Enum List Unsettable</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.tests.model6.impl.MyEnumListUnsettableImpl#getMyEnum <em>My Enum</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class MyEnumListUnsettableImpl extends CDOObjectImpl implements MyEnumListUnsettable +{ + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected MyEnumListUnsettableImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return Model6Package.Literals.MY_ENUM_LIST_UNSETTABLE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected int eStaticFeatureCount() + { + return 0; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + public EList<MyEnum> getMyEnum() + { + return (EList<MyEnum>)eGet(Model6Package.Literals.MY_ENUM_LIST_UNSETTABLE__MY_ENUM, true); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void unsetMyEnum() + { + eUnset(Model6Package.Literals.MY_ENUM_LIST_UNSETTABLE__MY_ENUM); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean isSetMyEnum() + { + return eIsSet(Model6Package.Literals.MY_ENUM_LIST_UNSETTABLE__MY_ENUM); + } + +} //MyEnumListUnsettableImpl diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6AdapterFactory.java index 050b50eb73..7f956a38fd 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6AdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6AdapterFactory.java @@ -20,6 +20,8 @@ import org.eclipse.emf.cdo.tests.model6.E; import org.eclipse.emf.cdo.tests.model6.F; import org.eclipse.emf.cdo.tests.model6.G; import org.eclipse.emf.cdo.tests.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; import org.eclipse.emf.cdo.tests.model6.PropertiesMap; import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue; import org.eclipse.emf.cdo.tests.model6.ReferenceObject; @@ -183,6 +185,18 @@ public class Model6AdapterFactory extends AdapterFactoryImpl } @Override + public Adapter caseMyEnumList(MyEnumList object) + { + return createMyEnumListAdapter(); + } + + @Override + public Adapter caseMyEnumListUnsettable(MyEnumListUnsettable object) + { + return createMyEnumListUnsettableAdapter(); + } + + @Override public Adapter defaultCase(EObject object) { return createEObjectAdapter(); @@ -414,6 +428,36 @@ public class Model6AdapterFactory extends AdapterFactoryImpl } /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model6.MyEnumList <em>My Enum List</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.cdo.tests.model6.MyEnumList + * @generated + */ + public Adapter createMyEnumListAdapter() + { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable <em>My Enum List Unsettable</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable + * @generated + */ + public Adapter createMyEnumListUnsettableAdapter() + { + return null; + } + + /** * Creates a new adapter for the default case. * <!-- begin-user-doc --> This default implementation returns null. <!-- * end-user-doc --> diff --git a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6Switch.java b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6Switch.java index 16014c172a..4d0da31a75 100644 --- a/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6Switch.java +++ b/plugins/org.eclipse.emf.cdo.tests.model6/src/org/eclipse/emf/cdo/tests/model6/util/Model6Switch.java @@ -20,6 +20,8 @@ import org.eclipse.emf.cdo.tests.model6.E; import org.eclipse.emf.cdo.tests.model6.F; import org.eclipse.emf.cdo.tests.model6.G; import org.eclipse.emf.cdo.tests.model6.Model6Package; +import org.eclipse.emf.cdo.tests.model6.MyEnumList; +import org.eclipse.emf.cdo.tests.model6.MyEnumListUnsettable; import org.eclipse.emf.cdo.tests.model6.PropertiesMap; import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue; import org.eclipse.emf.cdo.tests.model6.ReferenceObject; @@ -109,9 +111,7 @@ public class Model6Switch<T> Root root = (Root)theEObject; T result = caseRoot(root); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.BASE_OBJECT: @@ -119,9 +119,7 @@ public class Model6Switch<T> BaseObject baseObject = (BaseObject)theEObject; T result = caseBaseObject(baseObject); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.REFERENCE_OBJECT: @@ -129,13 +127,9 @@ public class Model6Switch<T> ReferenceObject referenceObject = (ReferenceObject)theEObject; T result = caseReferenceObject(referenceObject); if (result == null) - { result = caseBaseObject(referenceObject); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.CONTAINMENT_OBJECT: @@ -143,13 +137,9 @@ public class Model6Switch<T> ContainmentObject containmentObject = (ContainmentObject)theEObject; T result = caseContainmentObject(containmentObject); if (result == null) - { result = caseBaseObject(containmentObject); - } if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.UNORDERED_LIST: @@ -157,9 +147,7 @@ public class Model6Switch<T> UnorderedList unorderedList = (UnorderedList)theEObject; T result = caseUnorderedList(unorderedList); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.PROPERTIES_MAP: @@ -167,9 +155,7 @@ public class Model6Switch<T> PropertiesMap propertiesMap = (PropertiesMap)theEObject; T result = casePropertiesMap(propertiesMap); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.PROPERTIES_MAP_ENTRY: @@ -178,9 +164,7 @@ public class Model6Switch<T> Map.Entry<String, PropertiesMapEntryValue> propertiesMapEntry = (Map.Entry<String, PropertiesMapEntryValue>)theEObject; T result = casePropertiesMapEntry(propertiesMapEntry); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.PROPERTIES_MAP_ENTRY_VALUE: @@ -188,9 +172,7 @@ public class Model6Switch<T> PropertiesMapEntryValue propertiesMapEntryValue = (PropertiesMapEntryValue)theEObject; T result = casePropertiesMapEntryValue(propertiesMapEntryValue); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.A: @@ -198,9 +180,7 @@ public class Model6Switch<T> A a = (A)theEObject; T result = caseA(a); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.B: @@ -208,9 +188,7 @@ public class Model6Switch<T> B b = (B)theEObject; T result = caseB(b); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.C: @@ -218,9 +196,7 @@ public class Model6Switch<T> C c = (C)theEObject; T result = caseC(c); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.D: @@ -228,9 +204,7 @@ public class Model6Switch<T> D d = (D)theEObject; T result = caseD(d); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.E: @@ -238,9 +212,7 @@ public class Model6Switch<T> E e = (E)theEObject; T result = caseE(e); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.F: @@ -248,9 +220,7 @@ public class Model6Switch<T> F f = (F)theEObject; T result = caseF(f); if (result == null) - { result = defaultCase(theEObject); - } return result; } case Model6Package.G: @@ -258,9 +228,23 @@ public class Model6Switch<T> G g = (G)theEObject; T result = caseG(g); if (result == null) - { result = defaultCase(theEObject); - } + return result; + } + case Model6Package.MY_ENUM_LIST: + { + MyEnumList myEnumList = (MyEnumList)theEObject; + T result = caseMyEnumList(myEnumList); + if (result == null) + result = defaultCase(theEObject); + return result; + } + case Model6Package.MY_ENUM_LIST_UNSETTABLE: + { + MyEnumListUnsettable myEnumListUnsettable = (MyEnumListUnsettable)theEObject; + T result = caseMyEnumListUnsettable(myEnumListUnsettable); + if (result == null) + result = defaultCase(theEObject); return result; } default: @@ -487,6 +471,38 @@ public class Model6Switch<T> } /** + * Returns the result of interpreting the object as an instance of '<em>My Enum List</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>My Enum List</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMyEnumList(MyEnumList object) + { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>My Enum List Unsettable</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>My Enum List Unsettable</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMyEnumListUnsettable(MyEnumListUnsettable object) + { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. * <!-- begin-user-doc --> This * implementation returns null; returning a non-null result will terminate the switch, but this is the last case |