The following should do the trick, but it's not at all elegant. He gets eClassyou eObject, find an appropriate definition of the attribute by name and refers to him. Used here getEAllAttributes()also includes attributes defined by parent classes.
EObject eObject = null;
String attributeName = "";
EDataType resultingDataType = null;
EList<EAttribute> eAllAttributes = eObject.eClass().getEAllAttributes();
for (EAttribute eAttribute : eAllAttributes) {
if (eAttribute.getName().equals(attributeName)) {
resultingDataType = (EDataType) eObject.eGet(eAttribute);
}
}
System.out.println(resultingDataType);
source
share