Difference between revisions of "Documentation/DevGuide/ProUNO/Java/Mapping of UNOIDL"
OOoWikiBot (Talk | contribs) m (FINAL VERSION FOR L10N) |
|||
Line 16: | Line 16: | ||
An individual UNOIDL constant | An individual UNOIDL constant | ||
− | + | <syntaxhighlight lang="idl"> | |
module example { | module example { | ||
const long USERFLAG = 1; | const long USERFLAG = 1; | ||
}; | }; | ||
− | + | </syntaxhighlight> | |
is mapped to a public Java interface with the same name: | is mapped to a public Java interface with the same name: | ||
− | + | <syntaxhighlight lang="java"> | |
package example; | package example; | ||
Line 28: | Line 28: | ||
int value = 1; | int value = 1; | ||
} | } | ||
− | + | </syntaxhighlight> | |
Note that the use of individual constants is deprecated. | Note that the use of individual constants is deprecated. | ||
Line 34: | Line 34: | ||
A UNOIDL constant group | A UNOIDL constant group | ||
− | + | <syntaxhighlight lang="idl"> | |
module example { | module example { | ||
constants User { | constants User { | ||
Line 42: | Line 42: | ||
}; | }; | ||
}; | }; | ||
− | + | </syntaxhighlight> | |
is mapped to a public Java interface with the same name: | is mapped to a public Java interface with the same name: | ||
− | + | <syntaxhighlight lang="java"> | |
package example; | package example; | ||
Line 52: | Line 52: | ||
int FLAG3 = 3; | int FLAG3 = 3; | ||
} | } | ||
− | + | </syntaxhighlight> | |
Each constant defined in the group is mapped to a field of the interface with the same name and corresponding type and value. | Each constant defined in the group is mapped to a field of the interface with the same name and corresponding type and value. | ||
Latest revision as of 12:51, 23 December 2020
Mapping of UNOIDL Typedefs
UNOIDL typedefs are not visible in the Java language binding. Each occurrence of a typedef is replaced with the aliased type when mapping from UNOIDL to Java.
Mapping of Individual UNOIDL Constants
An individual UNOIDL constant
module example { const long USERFLAG = 1; };
is mapped to a public Java interface with the same name:
package example; public interface USERFLAG { int value = 1; }
Note that the use of individual constants is deprecated.
Mapping of UNOIDL Constant Groups
A UNOIDL constant group
module example { constants User { const long FLAG1 = 1; const long FLAG2 = 2; const long FLAG3 = 3; }; };
is mapped to a public Java interface with the same name:
package example; public interface User { int FLAG1 = 1; int FLAG2 = 2; int FLAG3 = 3; }
Each constant defined in the group is mapped to a field of the interface with the same name and corresponding type and value.
Mapping of UNOIDL Modules
A UNOIDL module is mapped to a Java package with the same name. This follows from the fact that each named UNO and UNOIDL entity is mapped to a Java class with the same name. (UNOIDL uses “::
” to separate the individual identifiers within a name, as in “com::sun::star::uno
”, whereas UNO itself and Java both use “.
”, as in “com.sun.star.uno
”; therefore, the name of a UNOIDL entity has to be converted in the obvious way before it can be used as a name in Java.) UNO and UNOIDL entities not enclosed in any module (that is, whose names do not contain any “.
” or “::
”, respectively), are mapped to Java classes in an unnamed package.
Content on this page is licensed under the Public Documentation License (PDL). |