Change metaobjects in Java actions

10
I've created a custom Java action in the modeler and managed to call it successfully from a microflow. The Java Action requires a parameter of a metaobject I've defined, "Person", which has a name (a String), a date of birth and an age (an integer). I'd like to use the Java action to set the age, based on the date of birth and the current date, but I can't really figure out how to do it.
asked
2 answers
6

The basics of programming with Mendix objects in Java are explained here: Java basics in Mendix, you will find an explanation + some examples there.

I wouldn't know how to calculate a persons age, but the website of Java might help you with this (Java Sun website)

answered
5

In the Java action you created you can change the incoming Person object using the generated Java proxies.

It will be something like person.setAge(22);

See the full Java programming reference guide for more detailed information.

answered