Common object environment provides run-time support. Based on support of the environment, applications can access interface objects defined in other language. There are two methods, we introduce them one by one in detail
First method, application can find interface object defined in other language using the function of environment. And then, it can access object’s attributes or call object’s functions. Interface objects may be identified by its UUID or name. Object’s name
should be used carefully because there may have multiple objects with the same name.
Second method, for environment supporting object-oriented programming, application can create an instance of entity class object of other language as talking about previously. The instance can be accessed by the two languages simultaneously. This method is more flexible. Application can create overloading functions of class object to support callback. For examples, if an object with function “Add” is defined in python language, application in java can create an instance of it and overloading the function “Add”. Then, python can callback to java through the “Add” function.
In above figure, python class object defines two functions “Add” and “Dec”. The “Add” function is overridden by java instance. The instance is managed by environment, and is visible to java and python. Python can call “Add” function of java instance to perform callback function. For “Dec” function, because instance does not override this function, the call will be redirected to class object of python.