Exporting 'domain value' of Enumeration literal

Hello, everyone

I am trying to export ‘domain value’ of literals in the enumeration, but I stopped at literals by enum.get_owned_literals() where trace becomes vague to find a way to get its domain value.

I guess the domain value is type as LiteralNumericValue. Could any goodness help me in the last mile?

BR
Jack

Something is missing in the Python API. But you can call the Java method:

myJavaDataValue = enum.get_java_object().getDomainValue()

But I also see that the API on DataValue is also limited… So I would not recommend wrapping the Java object in a Python DataValue:

DataValue(myJavaDataValue)

Instead you can call directly the Java method you need until we improve the API:

I opened an issue:

Thanks, Yvan. To work with similar problems, could you share the method to find the Java method list available for certain elements? For some trivil cases, I could find related keywords for java object in capella semantic or expert window, which was shared by Stephane before. Is that existing in Capella Studio? I guess.

You can use the Sirius interpreter, select an element and then use the following AQL expression to list all EStructuralFeatures:

self.eClass().eAllStructuralFeatures

You can then use the feature name to get the Java method name, for instance with a feature named someFeature:

  • getSomeFeature() or isSomeFeature() for boolean features
  • setSomeFeature(value) for mono valued features

You can also check the Capella metamodel or the source code.
You can also open a given Java class in your environment and navigate it using the JDT. For this you will need to enable Development capabilities.