Camunda Expression - Access field of object variable

I’m using Camunda 7.16 integrated with Springboot.

Question: Is there a way I can access a property of an object which is stored as a Camunda Variable, directly from a Camunda expression in bpmn?

In java, I have the following object:

public class Stage {
    private String name;
    private String level;

    // getters & setters

I have stored an instance of that object as a Camunda variable called “stage”.
I want to directly access the property “name” of that camunda variable through a camunda expression.

For example, I have tried the following:

but unfortunately none of them works.

Any ideas?


Ok, I found the solution. Posting it in case someone is interested:

or even

Just a word of warning on this.
All Camunda locations that will use that code will need to have access to the JAR that contains the getters for that object type.

It might be worthwhile storing it in the variable as a JSON object rather than a native POJO.