How Do I Know Which Type I Have?

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 07:25, 28 September 2007 by Cc208500 (Talk)

Jump to: navigation, search


A common problem is deciding what capabilities an object really has, after you receive it from a method. By observing the code completion in Java IDE, you can discover the base interface of an object returned from a method. You will notice that loadComponentFromURL() returns a

By pressing Alt + F1 in the NetBeans IDE you can read specifications about the interfaces and services you are using.

However, methods can only be specified to return one interface type. The interface you get from a method very often supports more interfaces than the one that is returned by the method (especially when the design of those interfaces predates the availability of multiple-inheritance interface types in UNO). Furthermore, the interface does not tell anything about the properties the object contains.

Therefore you should uses this manual to get an idea how things work. Then start writing code, using the code completion and the API reference.

In addition, you can try the InstanceInspector, a Java tool which is part of the SDK examples. It is a Java component that can be registered with the office and shows interfaces and properties of the object you are currently working with.

In Basic, you can inspect objects using the following Basic properties.

 sub main
   oDocument = thiscomponent
 end sub
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools