Why eGet() in EMF returns Object rather than EObject?

Posted by Gabriel Šcerbák on Stack Overflow See other posts from Stack Overflow or by Gabriel Šcerbák
Published on 2010-03-29T11:39:43Z Indexed on 2010/03/29 11:43 UTC
Read the original article Hit count: 405

I am working on some code using the EMF framework in Java, but it is really hard to use, e.g. I cannot implement OCL-like query API on top of EMF which would be type-safe. One of the reasons is that eGet() for a EStructuralFeature return just an Object, not EObject. So anything I would write must use much of null checking, type checking and type casting which is unsafe, not performant and cannot be generalized in a reusable way. Why doesn't EMF generate dummy implementations with EObject wrappers for arbitrary Object value? Implementing the EObject and hence the EClass interfaces even with simple throw UnsupportedOperationException is really a pain (the APIs are too big). The same holds for the eContainer() method which makes navigatinng the model upwards painful.

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about modeling