forked from whatwg/webidl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
java.xml
2665 lines (2535 loc) · 143 KB
/
java.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version='1.0'?>
<!--
java.xml
Java language binding for Web IDL
This is written in XHTML 1.0 Strict with an inline <options> element that
helps the WebIDL.xsl stylesheet process the document (generating a table
of contents, section numbers, certain processing instructions).
-->
<?xml-stylesheet href='WebIDL.xsl' type='text/xsl'?>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:x='http://mcc.id.au/ns/local' xml:lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<title>Java language binding for Web IDL</title>
<link rel='stylesheet' href='WebIDL.css' type='text/css'/>
<script src='section-links.js' type='application/ecmascript'/>
<script src='dfn.js' type='application/ecmascript'/>
<options xmlns='http://mcc.id.au/ns/local'>
<versions>
<cvs href='http://dev.w3.org/2006/webapi/WebIDL/java.html'/>
<this href='http://www.w3.org/TR/2013/NOTE-WebIDL-Java-20130514/'/>
<latest href='http://www.w3.org/TR/WebIDL-Java/'/>
<previous href='http://www.w3.org/TR/2012/WD-WebIDL-Java-20120207/'/>
</versions>
<editors>
<person homepage='http://mcc.id.au/' email='[email protected]'>
<name>Cameron McCormack</name>
<affiliation>Mozilla Corporation</affiliation>
</person>
</editors>
<maturity>WG-NOTE</maturity>
</options>
</head>
<body>
<?top?>
<div class='section'>
<h2>Abstract</h2>
<p>
This document defines the Java language binding for Web IDL,
the interface definition language for the Web platform.
</p>
</div>
<div class='section'>
<h2>Status of This Document</h2>
<?sotd-top [email protected] http://lists.w3.org/Archives/Public/public-script-coord/?>
<p>
This document originally existed as a section in the <cite>Web IDL</cite>
specification. <a href='#ref-WEBIDL'>[WEBIDL]</a> It was split out into this Working Group Note due to the prospect of it
impeding the progress of <cite>Web IDL</cite> due to having insufficient implementations and because
of a general lack of interest in the Java binding.
</p>
<p>
This document is produced by the
<a href='http://www.w3.org/2008/webapps/'>Web Applications Working Group</a>, part of the
<a href='http://www.w3.org/2006/rwc/Activity'>Rich Web Clients Activity</a>
in the W3C <a href='http://www.w3.org/Interaction/'>Interaction Domain</a>.
Changes made to this document can be found in the
<a href='http://dev.w3.org/cvsweb/2006/webapi/WebIDL/java.xml'>W3C
public CVS server</a>.
</p>
<p>
<strong>Note: The Working Group <a href="http://lists.w3.org/Archives/Public/public-webapps/2013AprJun/0398.html">reached consensus</a>
to stop work on this specification. It is being published for archival
reasons and is no longer being progressed along the W3C's Recommendation Track.</strong>
</p>
<!--
<p>
In addition to the issues marked by editorial notes in this document,
the <a href='http://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&product=WebAppsWG&component=WebIDL&longdesc_type=allwordssubstr&longdesc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailtype1=substring&email1=&emailtype2=substring&email2=&bug_id_type=anyexact&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=noop&type0-0-0=noop&value0-0-0='>Web IDL component in the W3C Bugzilla instance</a>
can be used file and track bugs.
</p>
-->
<?sotd-bottom http://www.w3.org/2004/01/pp-impl/42538/status?>
</div>
<div id='toc'>
<h2>Table of Contents</h2>
<?toc sections appendices?>
</div>
<div id='sections'>
<div id='introduction' class='section'>
<h2>Introduction</h2>
<p class='norm'>This section is informative.</p>
<p>
This document defines a Web IDL language binding for Java 5. <a href='#ref-WEBIDL'>[WEBIDL]</a> <a href='#ref-JLS3'>[JLS3]</a>
</p>
<div id='conventions' class='section'>
<h3>Typographic conventions</h3>
<p>
The following typographic conventions are used in this document:
</p>
<ul>
<li>Defining instances of terms: <dfn id='dfn-example-term'>example term</dfn></li>
<li>Links to terms defined in this document: <a class='dfnref' href='#dfn-example-term'>example term</a></li>
<li>Links to terms defined in other documents: <a class='dfnref external' href='#dfn-example-term'>example term</a></li>
<li>IDL and Java types: <span class='idltype'>ExampleType</span></li>
<li>Code snippets: <code>a = b + obj.f()</code></li>
<li>Unicode characters: <span class='char'>U+0030 DIGIT ZERO ("0")</span></li>
<li>Extended attributes: <span class='xattr'>[ExampleExtendedAttribute]</span></li>
<li>Variable names in prose and algorithms: <var>exampleVariableName</var>.</li>
<li>Non-normative notes: <div class='note'><p>This is a note.</p></div></li>
<li>Non-normative examples: <div class='example'><p>This is an example.</p></div></li>
<!--
<li>Normative warnings: <div class='warning'><p>This is a warning.</p></div></li>
-->
<li>Code blocks: <x:codeblock language='idl'><span class='comment'>// This is an IDL code block.</span>
interface Example {
attribute long something;
};</x:codeblock>
<x:codeblock language='java'><span class='comment'>// This is a Java code block.</span>
Document doc = element.getOwnerDocument();</x:codeblock></li>
</ul>
</div>
</div>
<div id='conformance' class='section'>
<h2>Conformance</h2>
<p>
Everything in this specification is normative except for diagrams,
examples, notes and sections marked as being informative.
</p>
<p>
The keywords “<span class='rfc2119'>MUST</span>”,
“<span class='rfc2119'>MUST NOT</span>”,
“<span class='rfc2119'>REQUIRED</span>”,
“<span class='rfc2119'>SHALL</span>”,
“<span class='rfc2119'>SHALL NOT</span>”,
“<span class='rfc2119'>SHOULD</span>”,
“<span class='rfc2119'>SHOULD NOT</span>”,
“<span class='rfc2119'>RECOMMENDED</span>”,
“<span class='rfc2119'>MAY</span>” and
“<span class='rfc2119'>OPTIONAL</span>” in this document are to be
interpreted as described in
<cite><a href='http://tools.ietf.org/html/rfc2119'>Key words for use in RFCs to
Indicate Requirement Levels</a></cite>
<a href='#ref-RFC2119'>[RFC2119]</a>.
</p>
<p>
The following conformance class is defined by this specification:
</p>
<dl>
<dt><dfn id='dfn-conforming-java-implementation'>conforming Java implementation</dfn></dt>
<dd>
<p>
A user agent is considered to be a
<a class='dfnref' href='#dfn-conforming-java-implementation'>conforming Java implementation</a>
relative to a <a class='dfnref' href='#dfn-conforming-idl-fragment'>conforming
IDL fragment</a> if it satisfies all of the <span class='rfc2119'>MUST</span>-,
<span class='rfc2119'>REQUIRED</span>- and <span class='rfc2119'>SHALL</span>-level
criteria in this specification that apply to implementations for the Java
language binding.
</p>
</dd>
</dl>
</div>
<div id='java-binding' class='section'>
<h2>Java binding</h2>
<p>
This section describes how definitions written with Web IDL <a href='#ref-WEBIDL'>[WEBIDL]</a>
correspond to particular constructs in Java 5 <a href='#ref-JLS3'>[JLS3]</a>.
</p>
<div id='java-names' class='section'>
<h3>Names</h3>
<p>
Since Java has a number of reserved words in the language, some identifiers
of Java constructs corresponding to IDL definitions need to be escaped
to avoid conflicts. A name is <dfn id='dfn-java-escaped'>Java escaped</dfn>
as follows:
</p>
<ul>
<li>
If the name is a Java reserved word, then the Java escaped name is the
name prefixed with a <span class='char'>U+005F LOW LINE ("_")</span>
character.
</li>
<li>
Otherwise, the name is not a Java reserved word. The Java escaped name
is simply the name.
</li>
</ul>
<div class='note'>
<p>
At the time of publication, the list of Java reserved words is the following:
<code>abstract</code>,
<code>assert</code>,
<code>boolean</code>,
<code>break</code>,
<code>byte</code>,
<code>case</code>,
<code>catch</code>,
<code>char</code>,
<code>class</code>,
<code>const</code>,
<code>continue</code>,
<code>default</code>,
<code>do</code>,
<code>double</code>,
<code>else</code>,
<code>enum</code>,
<code>extends</code>,
<code>final</code>,
<code>finally</code>,
<code>float</code>,
<code>for</code>,
<code>goto</code>,
<code>if</code>,
<code>implements</code>,
<code>import</code>,
<code>instanceof</code>,
<code>int</code>,
<code>interface</code>,
<code>long</code>,
<code>native</code>,
<code>new</code>,
<code>package</code>,
<code>private</code>,
<code>protected</code>,
<code>public</code>,
<code>return</code>,
<code>short</code>,
<code>static</code>,
<code>strictfp</code>,
<code>super</code>,
<code>switch</code>,
<code>synchronized</code>,
<code>this</code>,
<code>throw</code>,
<code>throws</code>,
<code>transient</code>,
<code>try</code>,
<code>void</code>,
<code>volatile</code>,
<code>while</code>.
</p>
</div>
</div>
<div id='java-type-mapping' class='section'>
<h3>Java type mapping</h3>
<p>
This section describes how types in the IDL map to types
in Java.
</p>
<p>
Each sub-section below describes how values of a given IDL type
are represented in Java. For each IDL type, it is described how
Java values are <dfn id='dfn-convert-java-to-idl-value'>converted to an IDL value</dfn>
when passed as an argument to a Java method (corresponding
to an <a class='dfnref' href='#dfn-operation'>operation</a> or
<a class='dfnref' href='#dfn-attribute'>attribute</a>). Conversely,
it is described how IDL values of that type are
<dfn id='dfn-convert-idl-to-java-value'>converted to Java values</dfn>
when being used as the value of a Java final variable (corresponding
to a <a class='dfnref' href='#dfn-constant'>constant</a>) or when
returned from a Java method (corresponding to an operation,
attribute or <a class='dfnref' href='#dfn-exception-field'>exception field</a>).
</p>
<div id='java-any' class='section'>
<h4>any</h4>
<p>
The <a class='idltype' href='#idl-any'>any</a> IDL type corresponds to a
Java <span class='javatype'>java.lang.Object</span> value.
</p>
<p>
How to <a class='dfnref' href='#dfn-convert-java-to-idl-value'>convert a Java value</a>
to an IDL <span class='idltype'>any</span> value depends on the
type of the Java value:
</p>
<dl class='switch'>
<dt>A <span class='javatype'>java.lang.Boolean</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>booleanValue()</code> method on the
<span class='javatype'>java.lang.Boolean</span> object to an IDL
<span class='idltype'>boolean</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.Byte</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>byteValue()</code> method on the
<span class='javatype'>java.lang.Byte</span> object to an IDL
<span class='idltype'>byte</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.Short</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>shortValue()</code> method on the
<span class='javatype'>java.lang.Short</span> object to an IDL
<span class='idltype'>short</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.Integer</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>intValue()</code> method on the
<span class='javatype'>java.lang.Integer</span> object to an IDL
<span class='idltype'>long</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.Long</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>longValue()</code> method on the
<span class='javatype'>java.lang.Long</span> object to an IDL
<span class='idltype'>long long</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.Float</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>floatValue()</code> method on the
<span class='javatype'>java.lang.Float</span> object to an IDL
<span class='idltype'>float</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.Double</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the result of calling the <code>doubleValue()</code> method on the
<span class='javatype'>java.lang.Double</span> object to an IDL
<span class='idltype'>double</span> value.
</dd>
<dt>A <span class='javatype'>java.lang.String</span> object</dt>
<dd>
The IDL value is obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the <span class='javatype'>java.lang.String</span> object to an IDL
<span class='idltype'>DOMString</span> value.
</dd>
<dt>An array object</dt>
<dd>
The IDL value is the <a href='#idl-sequence'>IDL sequence</a> obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the Java array object to a sequence, as described in
<a href='#java-sequence'>section <?sref java-sequence?></a> <?sdir java-sequence?>.
</dd>
<dt>An object that implements a <a class='dfnref' href='#dfn-java-array-interface'>Java array interface</a></dt>
<dd>
The IDL value is the <a href='#idl-array'>IDL array</a> obtained
by <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
the Java object to an array, as described in
<a href='#java-array'>section <?sref java-array?></a> <?sdir java-array?>.
</dd>
<dt>An object of any other class</dt>
<dd>
The IDL value is an <span class='idltype'>object</span> value
that references the same object.
</dd>
<dt><span class='javavalue'>null</span></dt>
<dd>
The IDL value is the <span class='idlvalue'>null</span>
<span class='idltype'>object?</span> value.
</dd>
</dl>
<p>
How to <a class='dfnref' href='#dfn-convert-idl-to-java-value'>convert</a>
an IDL <span class='idltype'>any</span> value to a Java
<span class='javatype'>java.lang.Object</span> value depends on the
<a class='dfnref' href='#dfn-specific-type'>specific type</a> of the IDL value:
</p>
<dl class='switch'>
<dt>A value of a <a class='dfnref' href='#dfn-primitive-type'>primitive type</a></dt>
<dd>
<p>
The Java value is the result of
<a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
the IDL value of the given type to a Java value, and then passing
that value to the static method according to the following table:
</p>
<table class='vert'>
<tr>
<th>IDL type</th>
<th>Method</th>
</tr>
<tr>
<td><a class='idltype' href='#idl-boolean'>boolean</a></td>
<td><code>java.lang.Boolean.valueOf(boolean)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-byte'>byte</a></td>
<td><code>java.lang.Byte.valueOf(byte)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-octet'>octet</a></td>
<td><code>java.lang.Byte.valueOf(byte)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-short'>short</a></td>
<td><code>java.lang.Short.valueOf(short)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-unsigned-short'>unsigned short</a></td>
<td><code>java.lang.Short.valueOf(short)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-long'>long</a></td>
<td><code>java.lang.Integer.valueOf(int)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-unsigned-long'>unsigned long</a></td>
<td><code>java.lang.Integer.valueOf(int)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-long-long'>long long</a></td>
<td><code>java.lang.Long.valueOf(long)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a></td>
<td><code>java.lang.Long.valueOf(long)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-float'>float</a></td>
<td><code>java.lang.Float.valueOf(float)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-unrestricted-float'>unrestricted float</a></td>
<td><code>java.lang.Float.valueOf(float)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-double'>double</a></td>
<td><code>java.lang.Double.valueOf(double)</code></td>
</tr>
<tr>
<td><a class='idltype' href='#idl-unrestricted-double'>unrestricted double</a></td>
<td><code>java.lang.Double.valueOf(double)</code></td>
</tr>
</table>
</dd>
<dt>An IDL value of any other type</dt>
<dd>
To obtain a Java value, the rules for converting the <a class='dfnref' href='#dfn-specific-type'>specific type</a>
of the IDL <a class='idltype' href='#idl-any'>any</a> value as described
in the remainder of this section are performed.
</dd>
</dl>
</div>
<div id='java-void' class='section'>
<h4>void</h4>
<p>
The only place that the <a class='idltype' href='#idl-void'>void</a> type may appear
in IDL is as the <a class='dfnref' href='#dfn-return-type'>return type</a>
of an <a class='dfnref' href='#dfn-operation'>operation</a>. Methods on Java objects
that implement an operation whose IDL specifies a <a class='idltype' href='#idl-void'>void</a>
return type <span class='rfc2119'>MUST</span> be declared to have a return type of <span class='javatype'>void</span>.
</p>
</div>
<div id='java-boolean' class='section'>
<h4>boolean</h4>
<p>
IDL <a class='idltype' href='#idl-boolean'>boolean</a> values are represented by
Java <span class='javatype'>boolean</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>boolean</span> value to an IDL value
is the IDL <span class='idltype'>boolean</span>
that represents the same truth value as the Java
<span class='javatype'>boolean</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>boolean</span> value to a Java
value is the Java <span class='javatype'>boolean</span> that
represents the same truth value as the IDL
<span class='idltype'>boolean</span>.
</p>
</div>
<div id='java-byte' class='section'>
<h4>byte</h4>
<p>
IDL <a class='idltype' href='#idl-byte'>byte</a> values are
represented by Java <span class='javatype'>byte</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>byte</span> value to an IDL value
is the IDL <span class='idltype'>byte</span>
that represents the same numeric value as the Java
<span class='javatype'>byte</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>byte</span> value to a Java
value is the Java <span class='javatype'>byte</span> that
represents the same numeric value as the IDL
<span class='idltype'>byte</span>.
</p>
</div>
<div id='java-octet' class='section'>
<h4>octet</h4>
<p>
IDL <a class='idltype' href='#idl-octet'>octet</a> values are represented by
Java <span class='javatype'>byte</span> values. Note that while
the IDL <a class='idltype' href='#idl-octet'>octet</a> type is unsigned, with a
range of [0, 255], the Java <span class='javatype'>byte</span> type
is signed, with a range of [−128, 127].
</p>
<p>
<a class='dfnref' href='#dfn-convert-idl-to-java-value'>Conversion</a>
of an <a class='idltype' href='#idl-octet'>octet</a> value to a
<span class='javatype'>byte</span> is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the <a class='idltype' href='#idl-octet'>octet</a> value to convert.</li>
<li>If <var>x</var> < 128, return the <span class='javatype'>byte</span> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> ≥ 128. Return the <span class='javatype'>byte</span> whose value is <var>x</var> − 256.</li>
</ol>
<div class='note'>
<p>
In Java this is the same as having the
<a class='idltype' href='#idl-octet'>octet</a> value stored in
an <span class='javatype'>int</span> and casting it to a
<span class='javatype'>byte</span>.
</p>
</div>
<p>
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>Conversion</a>
of a <span class='javatype'>byte</span> to an
<a class='idltype' href='#idl-octet'>octet</a> is performed as
follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the <span class='javatype'>byte</span> value to decode.</li>
<li>If <var>x</var> ≥ 0, return the <a class='idltype' href='#idl-octet'>octet</a> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> < 0. Return the <a class='idltype' href='#idl-octet'>octet</a> whose value is <var>x</var> + 256.</li>
</ol>
<div class='note'>
<p>
In Java this is the same as performing a bit-wise AND of the
<span class='javatype'>byte</span> value with the
<span class='javatype'>int</span> constant
<span class='javavalue'>0xff</span>.
</p>
</div>
</div>
<div id='java-short' class='section'>
<h4>short</h4>
<p>
IDL <a class='idltype' href='#idl-short'>short</a> values are
represented by Java <span class='javatype'>short</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>short</span> value to an IDL value
is the IDL <span class='idltype'>short</span>
that represents the same numeric value as the Java
<span class='javatype'>short</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>short</span> value to a Java
value is the Java <span class='javatype'>short</span> that
represents the same numeric value as the IDL
<span class='idltype'>short</span>.
</p>
</div>
<div id='java-unsigned-short' class='section'>
<h4>unsigned short</h4>
<p>
IDL <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> values are
represented by Java <span class='javatype'>short</span> values. Note that while
the IDL <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> type is unsigned, with a
range of [0, 65535], the Java <span class='javatype'>short</span> type
is signed, with a range of [−32768, 32767].
</p>
<p>
<a class='dfnref' href='#dfn-convert-idl-to-java-value'>Conversion</a>
of an IDL <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> value to a
Java <span class='javatype'>short</span> is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the IDL <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> value to convert.</li>
<li>If <var>x</var> < 32768, return the Java <span class='javatype'>short</span> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> ≥ 32768. Return the Java <span class='javatype'>short</span> whose value is <var>x</var> − 65536.</li>
</ol>
<div class='note'>
<p>
In Java this is the same as having the <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> value stored in
an <span class='javatype'>int</span> and casting it to a <span class='javatype'>short</span>.
</p>
</div>
<p>
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>Conversion</a>
of a Java <span class='javatype'>short</span> to an IDL
<a class='idltype' href='#idl-unsigned-short'>unsigned short</a> value
is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the Java <span class='javatype'>short</span> value to decode.</li>
<li>If <var>x</var> ≥ 0, return the IDL <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> < 0. Return the IDL <a class='idltype' href='#idl-unsigned-short'>unsigned short</a> whose value is <var>x</var> + 65536.</li>
</ol>
<div class='note'>
<p>
In Java this is the same as performing a bit-wise AND of the <span class='javatype'>short</span> value
with the <span class='javatype'>int</span> constant <span class='javavalue'>0xffff</span>.
</p>
</div>
</div>
<div id='java-long' class='section'>
<h4>long</h4>
<p>
IDL <a class='idltype' href='#idl-long'>long</a> values are
represented by Java <span class='javatype'>int</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>int</span> value to an IDL value
is the IDL <span class='idltype'>long</span>
that represents the same numeric value as the Java
<span class='javatype'>int</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>long</span> value to a Java
value is the Java <span class='javatype'>int</span> that
represents the same numeric value as the IDL
<span class='idltype'>short</span>.
</p>
</div>
<div id='java-unsigned-long' class='section'>
<h4>unsigned long</h4>
<p>
IDL <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> values are
represented by Java <span class='javatype'>int</span> values. Note that while
the IDL <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> type is unsigned, with a
range of [0, 4294967295], the Java <span class='javatype'>int</span> type
is signed, with a range of [−2147483648, 2147483647].
</p>
<p>
<a class='dfnref' href='#dfn-convert-idl-to-java-value'>Conversion</a>
of an IDL <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> value to a
Java <span class='javatype'>int</span> is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the IDL <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> value to convert.</li>
<li>If <var>x</var> < 2147483648, return the Java <span class='javatype'>int</span> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> ≥ 2147483648. Return the Java <span class='javatype'>int</span> whose value is <var>x</var> − 4294967296.</li>
</ol>
<div class='note'>
<p>
In Java this is the same as having the <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> value stored in
a Java <span class='javatype'>long</span> and casting it to an <span class='javatype'>int</span>.
</p>
</div>
<p>
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>Conversion</a>
of a Java <span class='javatype'>int</span> to an IDL
<a class='idltype' href='#idl-unsigned-long'>unsigned long</a> value
is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the Java <span class='javatype'>int</span> value to decode.</li>
<li>If <var>x</var> ≥ 0, return the IDL <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> < 0. Return the IDL <a class='idltype' href='#idl-unsigned-long'>unsigned long</a> whose value is <var>x</var> + 4294967296.</li>
</ol>
<div class='note'>
<p>
In Java this is the same as performing a bit-wise AND of the <span class='javatype'>int</span> value
with the <span class='javatype'>long</span> constant <span class='javavalue'>0xffffffffL</span>.
</p>
</div>
</div>
<div id='java-long-long' class='section'>
<h4>long long</h4>
<p>
IDL <a class='idltype' href='#idl-long-long'>long long</a> values are
represented by Java <span class='javatype'>long</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>long</span> value to an IDL value
is the IDL <span class='idltype'>long long</span>
that represents the same numeric value as the Java
<span class='javatype'>long</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>long long</span> value to a Java
value is the Java <span class='javatype'>long</span> that
represents the same numeric value as the IDL
<span class='idltype'>long long</span>.
</p>
</div>
<div id='java-unsigned-long-long' class='section'>
<h4>unsigned long long</h4>
<p>
IDL <a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> values are
represented by Java <span class='javatype'>long</span> values. Note that while
the IDL <a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> type is unsigned, with a
range of [0, 18446744073709551615], the Java <span class='javatype'>long</span> type
is signed, with a range of [−9223372036854775808, 9223372036854775807].
</p>
<p>
<a class='dfnref' href='#dfn-convert-idl-to-java-value'>Conversion</a>
of an IDL <a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> value to a
Java <span class='javatype'>long</span> is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the IDL <a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> value to convert.</li>
<li>If <var>x</var> < 18446744073709551616, return the Java <span class='javatype'>long</span> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> ≥ 18446744073709551616. Return the Java <span class='javatype'>long</span> whose value is <var>x</var> − 18446744073709551615.</li>
</ol>
<p>
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>Conversion</a>
of a Java <span class='javatype'>long</span> to an IDL
<a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> value
is performed as follows:
</p>
<ol class='algorithm'>
<li>Let <var>x</var> be the Java <span class='javatype'>long</span> value to decode.</li>
<li>If <var>x</var> ≥ 0, return the IDL <a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> whose value is <var>x</var>.</li>
<li>Otherwise <var>x</var> < 0. Return the IDL <a class='idltype' href='#idl-unsigned-long-long'>unsigned long long</a> whose value is <var>x</var> + 18446744073709551615.</li>
</ol>
</div>
<div id='java-float' class='section'>
<h4>float</h4>
<p>
IDL <a class='idltype' href='#idl-float'>float</a> values are
represented by Java <span class='javatype'>float</span> values.
</p>
<p>
A Java <span class='javatype'>float</span> value <var>V</var> is <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a>
to an IDL <span class='idltype'>float</span> value as follows:
</p>
<ol class='algorithm'>
<li>
If <var>V</var> is non-finite, then throw a <span class='javatype'>java.lang.IllegalArgumentException</span>.
</li>
<li>
Otherwise, the IDL <span class='idltype'>float</span> value is the one
that represents the same IEEE 754 single precision floating point value as <var>V</var>.
</li>
</ol>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>float</span> value to a Java
value is the Java <span class='javatype'>float</span> that
represents the same IEEE 754 single precision floating point value as the IDL
<span class='idltype'>float</span>.
</p>
</div>
<div id='java-unrestricted-float' class='section'>
<h4>unrestricted float</h4>
<p>
IDL <a class='idltype' href='#idl-unrestricted-float'>unrestricted float</a> values are
represented by Java <span class='javatype'>float</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>float</span> value to an IDL <span class='idltype'>unrestricted float</span>
value is the one that represents the same IEEE 754 single precision floating point value as the Java
<span class='javatype'>float</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>unrestricted float</span> value to a Java
value is the Java <span class='javatype'>float</span> that
represents the same IEEE 754 single precision floating point value as the IDL
<span class='idltype'>unrestricted float</span>.
</p>
</div>
<div id='java-double' class='section'>
<h4>double</h4>
<p>
IDL <a class='idltype' href='#idl-double'>double</a> values are
represented by Java <span class='javatype'>double</span> values.
</p>
<p>
A Java <span class='javatype'>double</span> value <var>V</var> is <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a>
to an IDL <span class='idltype'>double</span> value as follows:
</p>
<ol class='algorithm'>
<li>
If <var>V</var> is non-finite, then throw a <span class='javatype'>java.lang.IllegalArgumentException</span>.
</li>
<li>
Otherwise, the IDL <span class='idltype'>double</span> value is the one
that represents the same IEEE 754 double precision floating point value as <var>V</var>.
</li>
</ol>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>double</span> value to a Java
value is the Java <span class='javatype'>double</span> that
represents the same IEEE 754 double precision floating point value as the IDL
<span class='idltype'>double</span>.
</p>
</div>
<div id='java-unrestricted-double' class='section'>
<h4>unrestricted double</h4>
<p>
IDL <a class='idltype' href='#idl-unrestricted-double'>unrestricted double</a> values are
represented by Java <span class='javatype'>double</span> values.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a>
a Java <span class='javatype'>double</span> value to an IDL <span class='idltype'>unrestricted double</span>
value is the one that represents the same IEEE 754 double precision floating point value as the Java
<span class='javatype'>double</span>.
</p>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>unrestricted double</span> value to a Java
value is the Java <span class='javatype'>double</span> that
represents the same IEEE 754 double precision floating point value as the IDL
<span class='idltype'>unrestricted double</span>.
</p>
</div>
<div id='java-DOMString' class='section'>
<h4>DOMString</h4>
<p>
IDL <a class='idltype' href='#idl-DOMString'>DOMString</a> values are
represented by Java <span class='javatype'>java.lang.String</span> reference
values.
</p>
<p>
A Java <span class='javatype'>java.lang.String</span> reference value is
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a>
to an IDL <span class='idltype'>DOMString</span> value as follows:
</p>
<ul>
<li>If the value is <span class='javavalue'>null</span>, then throw a <span class='javatype'>java.lang.NullPointerException</span>.</li>
<li>
Otherwise, return the IDL <a class='idltype' href='#idl-DOMString'>DOMString</a>
value that represents the same sequence of <a class='dfnref' href='#dfn-code-unit'>code units</a> as the one
the Java <span class='javatype'>java.lang.String</span> value
represents.
</li>
</ul>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>DOMString</span> value to a Java
<span class='javatype'>java.lang.String</span> value is a
<span class='javatype'>java.lang.String</span>
object that represents the same sequence of characters that the
IDL <span class='idltype'>DOMString</span> represents.
</p>
</div>
<div id='java-object' class='section'>
<h4>object</h4>
<p>
IDL <a class='idltype' href='#idl-object'>object</a> values are
represented by Java <span class='javatype'>java.lang.Object</span> reference
values.
</p>
<p>
A Java <span class='javatype'>java.lang.Object</span> reference value is
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a>
to an IDL <span class='idltype'>object</span> value as follows:
</p>
<ul>
<li>If the value is <span class='javavalue'>null</span>, then throw a <span class='javatype'>java.lang.NullPointerException</span>.</li>
<li>
Otherwise, return the IDL <span class='idltype'>object</span> value that
is a reference to the same object.
</li>
</ul>
<p>
The result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a>
an IDL <span class='idltype'>object</span> value to a Java
value is a Java <span class='javatype'>java.lang.Object</span> value
that is a reference to the same object.
</p>
</div>
<div id='java-interface' class='section'>
<h4>Interface types</h4>
<p>
IDL <a href='#idl-interface'>interface type</a> values are
represented by Java references of the corresponding Java interface type.
(See <a href='#java-interfaces'>section <?sref java-interfaces?></a> <?sdir java-interfaces?>
for how IDL <a class='dfnref' href='#dfn-interface'>interfaces</a> have
corresponding Java interfaces.)
</p>
<p>
A Java value <var>V</var> is
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a>
to an IDL <a href='#idl-interface'>interface type</a> value
by running the following algorithm (where <var>I</var> is the <a class='dfnref' href='#dfn-interface'>interface</a>):
</p>
<ol class='algorithm'>
<li>If <var>V</var> is a <a class='dfnref' href='#dfn-platform-object'>platform object</a> that implements <var>I</var>,
then return the IDL <a href='#idl-interface'>interface type</a> value that represents a reference to that platform object.</li>
<li>Otherwise, throw a <span class='javatype'>java.lang.IllegalArgumentException</span>.</li>
</ol>
<p>
<a class='dfnref' href='#dfn-convert-idl-to-java-value'>Conversions from</a> IDL
<a href='#idl-interface'>interface type</a> values to Java values
are performed in the same way as that for the IDL
<a class='idltype' href='#idl-object'>object</a> type.
</p>
</div>
<div id='java-dictionary' class='section'>
<h4>Dictionary types</h4>
<p>
IDL <a href='#idl-dictionary'>dictionary type</a> values are
represented by Java references to objects of the
<span class='javatype'>java.util.HashMap<java.lang.String,java.lang.Object></span> class.
Each <a class='dfnref' href='#dfn-dictionary-member'>dictionary member</a> that is
<a class='dfnref' href='#dfn-present'>present</a>
corresponds to an entry in the <span class='javatype'>HashMap</span>.
</p>
<p>
A Java <span class='javatype'>java.util.HashMap<java.lang.String,java.lang.Object></span> reference value
<var>O</var> is
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a>
to an IDL <a href='#idl-dictionary'>dictionary type</a> value
by running the following algorithm (where <var>D</var> is the <a class='dfnref' href='#dfn-dictionary'>dictionary</a>):
</p>
<ol class='algorithm'>
<li>If <var>O</var> is <span class='javavalue'>null</span>, then throw a <span class='javatype'>java.lang.NullPointerException</span>.</li>
<li>Let <var>dict</var> be an empty dictionary value of type <var>D</var>;
every <a class='dfnref' href='#dfn-dictionary-member'>dictionary member</a>
is initially considered to be <a class='dfnref' href='#dfn-present'>not present</a>.</li>
<li>Let <var>dictionaries</var> be a list consisting of <var>D</var> and all of <var>D</var>’s <a class='dfnref' href='#dfn-inherited-dictionaries'>inherited dictionaries</a>,
in order from least to most derived.</li>
<li>For each dictionary <var>dictionary</var> in <var>dictionaries</var>, in order:
<ol>
<li>For each dictionary member <var>member</var> declared on <var>dictionary</var>, in order:
<ol>
<li>Let <var>key</var> be the <a class='dfnref' href='#dfn-identifier'>identifier</a> of <var>member</var>.</li>
<li>Let <var>javaKey</var> be the result of <a class='dfnref' href='#dfn-convert-idl-to-java-value'>converting</a> <var>key</var> to a <span class='javatype'>java.lang.String</span>.</li>
<li>Let <var>present</var> be the result of calling the <code>containsKey</code> method on <var>O</var> with <var>javaKey</var> as the only argument.</li>
<li>If <var>present</var> is true, then:
<ol>
<li>Let <var>value</var> be the result of calling the <code>get</code> method on <var>O</var> <var>javaKey</var> as the only argument.</li>
<li>Let <var>idlValue</var> be the result of <a class='dfnref' href='#dfn-convert-java-to-idl-value'>converting</a> <var>value</var> to an IDL value whose type is the type <var>member</var> is declared to be of.</li>
<li>Set the dictionary member on <var>dict</var> with key name <var>key</var> to the value <var>idlValue</var>. This dictionary member is considered to be <a class='dfnref' href='#dfn-present'>present</a>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
<li>Return <var>dict</var>.</li>
</ol>
<p>
An IDL <a href='#idl-dictionary'>dictionary type</a> value <var>V</var> is
<a class='dfnref' href='#dfn-convert-java-to-idl-value'>converted</a> to a Java
<span class='javatype'>java.util.HashMap<java.lang.String,java.lang.Object></span> reference value
by running the following algorithm (where <var>D</var> is the <a class='dfnref' href='#dfn-dictionary'>dictionary</a>):