odejava - Getting a SWIGTYPE... from an int?

The Contact class contains a number of methods which return an int ID, such as getGeomID1(). How can you get a SWIGTYPE_p_dGeomID object from this int?

The only way that I can see is to keep a mapping from “nativeAddr” ints to Geom objects. Then when iterating over a Contact object, use the getGeomID1() method to retrieve the key for this map which will find the correspoding Geom object, on which getID() can be called to get the SWIGTYPE_p_dGeomID.

Is this the way it should be done, or is there a simpler way?