Difference between revisions of "Documentation/DevGuide/WritingUNO/XInitialization"
OOoWikiBot (Talk | contribs) m (Robot: Changing Category:Documentation/Developers Guide/Writing UNO Components) |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
|NextPage=Documentation/DevGuide/WritingUNO/XMain | |NextPage=Documentation/DevGuide/WritingUNO/XMain | ||
}} | }} | ||
+ | {{Documentation/DevGuideLanguages|Documentation/DevGuide/WritingUNO/{{SUBPAGENAME}}}} | ||
{{DISPLAYTITLE:XInitialization}} | {{DISPLAYTITLE:XInitialization}} | ||
<!--<idltopic>com.sun.star.lang.XInitialization</idltopic>--> | <!--<idltopic>com.sun.star.lang.XInitialization</idltopic>--> | ||
Line 10: | Line 11: | ||
The specification for <code>XInitialization</code> looks like this: | The specification for <code>XInitialization</code> looks like this: | ||
− | < | + | <syntaxhighlight lang="idl"> |
// module com::sun::star::lang | // module com::sun::star::lang | ||
Line 17: | Line 18: | ||
void initialize(sequence< any > aArguments) raises (com::sun::star::uno::Exception); | void initialize(sequence< any > aArguments) raises (com::sun::star::uno::Exception); | ||
}; | }; | ||
− | </ | + | </syntaxhighlight> |
An old-style UNOIDL service specification will typically specify which arguments and in which order are expected within the any sequence. | An old-style UNOIDL service specification will typically specify which arguments and in which order are expected within the any sequence. | ||
Latest revision as of 17:21, 23 December 2020
- XInterface
- XTypeProvider
- XServiceInfo
- XWeak
- XComponent
- XInitialization
- XMain
- XAggregation
- XUnoTunnel
The interface com.sun.star.lang.XInitialization is usually implemented manually, because only the programmer knows how to initialize the object with arguments received from the service manager through createInstanceWithArguments()
or createInstanceWithArgumentsAndContext()
. In Java, XInitialization
is used as well, but know that the Java factory helper provides a shortcut that uses arguments without implementing XInitialization
directly. The Java factory helper can pass arguments to the class constructor under certain conditions. Refer to the section Create Instance with Arguments for more information.
The specification for XInitialization
looks like this:
// module com::sun::star::lang interface XInitialization : com::sun::star::uno::XInterface { void initialize(sequence< any > aArguments) raises (com::sun::star::uno::Exception); };
An old-style UNOIDL service specification will typically specify which arguments and in which order are expected within the any sequence.
With the advent of new-style service specifications with explicit constructors, you can now declare explicitly what arguments can be passed to an object when creating it. The arguments listed in a constructor are exactly the arguments passed to XInitialization.initialize
(the various language bindings currently use XInitialization
internally to implement service constructors; that may change in the future, however).
Content on this page is licensed under the Public Documentation License (PDL). |