Difference between revisions of "Documentation/DevGuide/ProUNO/Java/Mapping of UNOIDL"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (1 revision(s))
 
(4 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
|NextPage=Documentation/DevGuide/ProUNO/Java/Mapping of Services
 
|NextPage=Documentation/DevGuide/ProUNO/Java/Mapping of Services
 
}}
 
}}
 +
{{Documentation/DevGuideLanguages|Documentation/DevGuide/ProUNO/Java/{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:Mapping of UNOIDL}}
 
{{DISPLAYTITLE:Mapping of UNOIDL}}
 
__NOTOC__
 
__NOTOC__
Line 15: 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 27: 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 33: Line 34:
  
 
A UNOIDL constant group
 
A UNOIDL constant group
 
+
<syntaxhighlight lang="idl">
 
   module example {  
 
   module example {  
 
       constants User {
 
       constants User {
Line 41: 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 51: 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.
  
Line 59: Line 60:
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Professional UNO]]
+
 
 +
[[Category:Documentation/Developer's Guide/Professional UNO]]

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).
Personal tools
In other languages