Navigating associations in Java

I can't work out how to retrieve an IMendixObject by navigating an association. Suppose a Job is charged to a Branch, so that a Job (IMendixObject jobObject) is associated with a Branch by means of association Job_Branch. If I write IMendixObject branch = jobObject.getValue(Job.MemberNames.Job_Branch.toString()) ... then I get an Object, not an IMendixObject or an IMendixIdentifier, and I can't access the member fields of branch. How do you navigate associations between IMendixObjects?
1 answers

The getValue() method will return an IMendixIdentifier if it's a reference and a List<IMendixIdentifier> if it's a reference set. Depending on whether it's a reference or a reference set Core.retrieveId(Context, IMendixIdentifier) or Core.retrieveIdList(Context, List<IMendixIdentifier) can be used to retrieve the referred MendixObject(s).