| Summary: | Conversion of an enumeration fails | ||
|---|---|---|---|
| Product: | [Modeling] EMFT | Reporter: | Filip Hrbek <filip.hrbek> |
| Component: | Texo | Assignee: | Martin Taal <mtaal> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
This should be fixed in the latest build which is available now. gr. Martin |
Conversion of an attribute whose type is an enumeration fails on ClassCastException when converting from POJO to EMF. The converting method in org.eclipse.emf.texo.xml.ModelEMFConverter looks like this: protected Object convertEAttributeValue(final Object value, final EDataType eDataType) { if (value instanceof Enum<?>) { final EDataType enumDataType = getDataTypeOrBaseType(eDataType); Check.isInstanceOf(enumDataType, EEnum.class); final EEnum eeNum = (EEnum) enumDataType; for (final EEnumLiteral enumLiteral : eeNum.getELiterals()) { // the code generation template uppercases enum if (enumLiteral.getName().toUpperCase().equals(((Enum<?>) value).name())) { return enumLiteral; } } } ... } Perhaps the value to return should be "enumLiteral.getInstance()" instead of the bare "enumLiteral"?