-
Notifications
You must be signed in to change notification settings - Fork 9
/
converters.html
1423 lines (1382 loc) · 76.4 KB
/
converters.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Copyright (C) 2005, 2006 Joe Walnes.
Copyright (C) 2006, 2007, 2008, 2021 XStream committers.
All rights reserved.
The software in this package is published under the terms of the BSD
style license a copy of which has been included with this distribution in
the LICENSE.txt file.
Created on 29. January 2005 by Joe Walnes
-->
<head>
<title>XStream - Converters</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<style type="text/css">
.example { font-family: courier; font-size: 8pt; }
#content td { border-top: thin solid #5c5 ;}
#content .headerRow { background-color: white; }
</style>
<!-- Google analytics -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-110973-2";
urchinTracker();
</script>
</head>
<body>
<div id="banner">
<a href="index.html"><img id="logo" src="logo.gif" alt="XStream"/></a>
</div>
<div id="center" class="Content2Column"> <!-- Content3Column for index -->
<div id="content">
<h1 class="FirstChild">Converters</h1>
<p>The core of XStream consists of a registry of
<a href="javadoc/com/thoughtworks/xstream/converters/Converter.html"><b>Converters</b></a>. The responsibility
of a Converter is to provide a strategy for converting particular types of objects found in the object graph,
to and from XML.</p>
<p>XStream is provided with Converters for common types such as primitives, String, File, Collections, arrays,
and Dates. The following table lists any converter delivered with XStream and documents, if they are
registered by default with which priority.</p>
<table class="examplesTable" summary="Overview over all Converters delivered with XStream">
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.lang">java.lang (and core special types)</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/NullConverter.html">NullConverter</a></td>
<td>null values</td>
<td class="example"><null/></td>
<td>Usually, null fields are left out of the XML, however when used in arrays or the root object they
have to be explicitly marked.</td>
<td>very high</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/ArrayConverter.html">ArrayConverter</a></td>
<td>any kind of array</td>
<td class="example">
<<i>string</i>-array><br/>
<<i>string</i>>apple</<i>string</i>><br/>
<<i>string</i>>banana</<i>string</i>><br/>
<<i>string</i>>cabbage</<i>string</i>><br/>
<<i>string</i>-array>
</td>
<td>This supports arrays of primitives as well as objects. It also supports multi-dimensional arrays, even if
they are non-rectangular.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/BooleanConverter.html">BooleanConverter</a></td>
<td>boolean<br/>java.lang.Boolean</td>
<td class="example"><boolean>true</boolean></td>
<td>Can also be registered locally using different values.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/ByteConverter.html">ByteConverter</a></td>
<td>byte<br/>java.lang.Byte</td>
<td class="example"><byte>22</byte></td>
<td>The byte is represented as an integer.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/EncodedByteArrayConverter.html">EncodedByteArrayConverter</a></td>
<td>byte[]</td>
<td class="example"><byte-array>AHiEFiEABQ==</byte-array></td>
<td>Uses Base64 encoding to store binary data in XML. Converter can be registered globally or locally.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/CharConverter.html">CharConverter</a></td>
<td>char<br/>java.lang.Character</td>
<td class="example"><char>X</char><br/><char null="true"/></td>
<td>The '\0' character is invalid in XML.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/CharArrayConverter.html">CharArrayConverter</a></td>
<td>char[]</td>
<td class="example"><char-array>hello<char-array></td>
<td>Joins all characters into a single String.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/DoubleConverter.html">DoubleConverter</a></td>
<td>double<br/>java.lang.Double</td>
<td class="example"><double>456774543443.4553435</double></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/FloatConverter.html">FloatConverter</a></td>
<td>float<br/>java.lang.Float</td>
<td class="example"><float>4563443.435</float></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/IntConverter.html">IntConverter</a></td>
<td>int<br/>java.lang.Integer</td>
<td class="example"><int>12345678</int></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/LongConverter.html">LongConverter</a></td>
<td>long<br/>java.lang.Long</td>
<td class="example"><long>2344556678888786</long></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/NamedArrayConverter.html">NamedArrayConverter</a></td>
<td>any kind of array</td>
<td class="example">
<<i>string</i>-array><br/>
<<i>product</i>>apple</<i>product</i>><br/>
<<i>product</i>>banana</<i>product</i>><br/>
<<i>product</i>>cabbage</<i>product</i>><br/>
<<i>string</i>-array>
</td>
<td>This supports arrays of primitives as well as objects. It also supports multi-dimensional arrays, even if
they are non-rectangular. Should be registered locally or for an individual array type.</td>
<td> </td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/ShortConverter.html">ShortConverter</a></td>
<td>short<br/>java.lang.Short</td>
<td class="example"><short>1445</short></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/StringConverter.html">StringConverter</a></td>
<td>java.lang.String</td>
<td class="example"><string>hello world</string></td>
<td>This converter can be registered with different caching strategies.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/StringBufferConverter.html">StringBufferConverter</a></td>
<td>java.lang.StringBuffer</td>
<td class="example"><string-buffer>hello world</string-buffer></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/StringBuildererConverter.html">StringBuilderConverter</a></td>
<td>java.lang.StringBuilder</td>
<td class="example"><string-builder>hello world</string-builder></td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/ThrowableConverter.html">ThrowableConverter</a></td>
<td>java.lang.Throwable<br/>java.lang.Exception<br/>java.lang.RuntimeException<br/>java.lang.Error<br/>...and all subclasses
of these.</td>
<td class="example">
<java.io.IOException><br/>
<detailMessage>No file</detailMessage><br/>
<stack-trace><br/>
<trace>com.x.Foo.stuff(Foo.java:22)</trace><br/>
<trace>com.x.Foo.blah(Foo.java:31)</trace><br/>
<trace>com.x.Foo.main(Foo.java:43)</trace><br/>
</stack-trace><br/>
</java.io.IOException>
</td>
<td>This is only available with Java 1.4 or higher. It retains the full stack trace, including that of any
nested exceptions. The stack trace elements are handled by the
<a href="javadoc/com/thoughtworks/xstream/converters/extended/StackTraceElementConverter.html">StackTraceElementConverter</a>.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/enums/EnumConverter.html">EnumConverter</a></td>
<td>java.lang.Enum</td>
<td class="example"><java.lang.annotation.RetentionPolicy><br/>CLASS<br/></java.lang.annotation.RetentionPolicy></td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/enums/EnumToStringConverter.html">EnumToStringConverter</a></td>
<td>java.lang.Enum</td>
<td>The Converter must be initialized with an Enum type and an optional mapping between strings and enum values. By default
it will use the Enum's string representation as value.</td>
<td>Available with Java 1.5 or higher. Must be registered explicitly for the Enum type or locally.</td>
<td> </td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.util">java.util</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/CollectionConverter.html">CollectionConverter</a></td>
<td>java.util.ArrayList<br/>java.util.LinkedList<br/>java.util.HashSet<br/>java.util.Vector<br/>java.util.LinkedHashSet</td>
<td class="example">
<linked-list><br/>
<string>apple</string><br/>
<string>banana</string><br/>
<big-decimal>12345.4555</big-decimal><br/>
</linked-list>
</td>
<td>The objects inside the collection can be any type of objects, including nested collections. Can be
registered for an individual Collection type or locally, suppression of implicit type might be
necessary.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/MapConverter.html">MapConverter</a></td>
<td>java.util.HashMap<br/>java.util.Hashtable<br/>java.util.LinkedHashMap<br/>java.util.concurrent.ConcurrentHashMap</td>
<td class="example">
<map><br/>
<entry><br/>
<string>apple</string><br/>
<float>123.553</float><br/>
</entry><br/>
<entry><br/>
<string>orange</string><br/>
<float>55.4</float><br/>
</entry><br/>
</map>
</td>
<td>Both key and values can be any type of objects. Can be registered for an individual Map type or
locally, suppression of implicit type might be necessary.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/NamedCollectionConverter.html">NamedCollectionConverter</a></td>
<td>java.util.ArrayList<br/>java.util.LinkedList<br/>java.util.HashSet<br/>java.util.Vector<br/>java.util.LinkedHashSet</td>
<td class="example">
<fruits><br/>
<fruit>apple</fruit><br/>
<fruit>banana</fruit><br/>
<fruit>orange</fruit><br/>
</fruits>
</td>
<td>The objects inside the collection can be of any type shared between the objects. Should be
registered locally or for an individual Collection type.</td>
<td> </td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/NamedMapConverter.html">NamedMapConverter</a></td>
<td>java.util.HashMap<br/>java.util.Hashtable<br/>java.util.LinkedHashMap<br/>java.util.concurrent.ConcurrentHashMap</td>
<td class="example">
<map><br/>
<fruit><br/>
<name>apple</name><br/>
<price>123.553</price><br/>
</fruit><br/>
<fruit><br/>
<name>orange</name><br/>
<price>55.4</price><br/>
</fruit><br/>
</map>
</td>
<td>Both key and values can be any type of objects. If key or value are written as attributes or if
the value is written as text of the entry element, those types must be handled by a
<a href="javadoc/com/thoughtworks/xstream/converters/SingleValueConverter.html">SingleValueConverter</a>.
Should be registered locally or for an individual Map type.</td>
<td> </td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/PropertiesConverter.html">PropertiesConverter</a></td>
<td>java.util.Properties</td>
<td class="example">
<properties><br/>
<property name="host" value="localhost"/><br/>
<property name="port" value="888"/><br/>
</properties>
</td>
<td>Because the Properties class only accepts Strings for keys and values, the XML can be more concise.
If the Properties instance includes a set of default Properties, these are serialized in a nested <code><defaults></code> element.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/WeakHashMapConverter.html">WeakHashMapConverter</a></td>
<td>java.util.WeakHashMap</td>
<td class="example">
<weak-hash-map/>
</td>
<td>A WeakHashMap is supposed to release its elements when they are no longer referenced. Therefore is at unmarshalling time no guarantee that
an entry is still available when it is referenced later in the stream. As consequence the converter will marshal no elements at all, it
will create an empty WeakHashMap at unmarshalling time.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/SingletonCollectionConverter.html">SingletonCollectionConverter</a></td>
<td>java.util.Collections.singletonList().getClass()<br/>java.util.Collections.singleton().getClass()</td>
<td class="example">
<singleton-set><br/>
<string>apple</string><br/>
</singleton-set>
</td>
<td>The objects inside the singleton collection can be any type of objects, including nested collections.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/SingletonMapConverter.html">SingletonMapConverter</a></td>
<td>java.util.Collections.singletonMap().getClass()</td>
<td class="example">
<singleton-map><br/>
<entry><br/>
<string>apple</string><br/>
<float>123.553</float><br/>
</entry><br/>
</singleton-map>
</td>
<td>The objects inside the singleton collection can be any type of objects, including nested collections.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/TreeMapConverter.html">TreeMapConverter</a></td>
<td>java.util.TreeMap</td>
<td class="example">
<tree-map><br/>
<comparator class="com.blah.MyComparator"/><br/>
<entry><br/>
<string>apple</string><br/>
<float>123.553</float><br/>
</entry><br/>
<entry><br/>
<string>orange</string><br/>
<float>55.4</float><br/>
</entry><br/>
</tree-map>
</td>
<td>This is similar to MapConverter with an additional field for storing the java.util.Comparator associated with the TreeMap.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/TreeSetConverter.html">TreeSetConverter</a></td>
<td>java.util.TreeSet</td>
<td class="example">
<tree-set><br/>
<comparator class="com.blah.MyComparator"/><br/>
<string>apple</string><br/>
<string>banana</string><br/>
<string>cabbage</string><br/>
</tree-set>
</td>
<td>This is similar to CollectionConverter with an additional field for storing the java.util.Comparator associated with the TreeSet.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/collections/BitSetConverter.html">BitSetConverter</a></td>
<td>java.util.BitSet</td>
<td class="example">
<bit-set>0,1,3,5,6,8,10</bit-set>
</td>
<td>Stores a comma separated list of which bits are set. Designed to be readable without taking up too much space.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/DateConverter.html">DateConverter</a></td>
<td>java.util.Date</td>
<td class="example"><date>2004-02-22 15:16:04.0 UTC</date></td>
<td>Can be registered with different formats, locales or time zone globally or locally.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/GregorianCalendarConverter.html">GregorianCalendarConverter</a></td>
<td>java.util.Calendar<br/>java.util.GregorianCalendar</td>
<td class="example">
<gregorian-calendar><br/>
<time>555454646</time><br/>
</gregorian-calendar>
</td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/ISO8601DateConverter.html">ISO8601DateConverter</a></td>
<td>java.util.Date</td>
<td class="example"><date>2006-07-28T12:06:17.654-03:00</date></td>
<td>Not automatically registered, can be used globally or locally. Implementation needs joda-time for JDK 1.7 or below.</td>
<td> </td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/ISO8601GregorianCalendarConverter.html">ISO8601GregorianCalendarConverter</a></td>
<td>java.util.GregorianCalendar</td>
<td class="example">
<gregorian-calendar><br/>
2006-07-28T12:07:02.788-03:00<br/>
</gregorian-calendar>
</td>
<td>Not automatically registered, can be used globally or locally. Implementation needs joda-time for JDK 1.7 or below.</td>
<td> </td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/LocaleConverter.html">LocaleConverter</a></td>
<td>java.util.Locale</td>
<td class="example"><locale>en_GB</locale></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/CurrencyConverter.html">CurrencyConverter</a></td>
<td>java.util.Currency</td>
<td class="example"><currency>USD</currency></td>
<td>Available with Java 1.4 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/UUIDConverter.html">UUIDConverter</a></td>
<td>java.util.UUID</td>
<td class="example"><uuid>ca05f023-e07f-4956-a6ef-14ddd23df47b</uuid></td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/OptionalConverter.html">OptionalConverter</a></td>
<td>java.util.Optional</td>
<td class="example">
<optional><br/>
<value class="string">test</value><br/>
</optional>
</td>
<td>Available with Java 1.8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/OptionalDoubleConverter.html">OptionalDoubleConverter</a></td>
<td>java.util.OptionalDouble</td>
<td class="example"><optional-double>1.8</optional-double></td>
<td>Available with Java 1.8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/OptionalIntConverter.html">OptionalIntConverter</a></td>
<td>java.util.OptionalInt</td>
<td class="example"><optional-int>42</optional-int></td>
<td>Available with Java 1.8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/OptionalLongConverter.html">OptionalLongConverter</a></td>
<td>java.util.OptionalLong</td>
<td class="example"><optional-long>2344556678888786</optional-long></td>
<td>Available with Java 1.8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/enums/EnumMapConverter.html">EnumMapConverter</a></td>
<td>java.util.EnumMap</td>
<td class="example">
<enum-map enum-type="simple"><br/>
<entry><br/>
<simple>GREEN</simple><br/>
<string>grass</string><br/>
</entry><br/>
<entry><br/>
<simple>BLUE</simple><br/>
<string>sky</string><br/>
</entry><br/>
</enum-map></td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/enums/EnumSetConverter.html">EnumSetConverter</a></td>
<td>java.util.EnumSet</td>
<td class="example">
<enum-set enum-type="simple"><br/>
GREEN,BLUE<br/>
</enum-set></td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/RegexPatternConverter.html">RegexPatternConverter</a></td>
<td>java.util.regex.Pattern</td>
<td class="example">
<java.util.regex.Pattern><br/>
<pattern>.*</pattern><br/>
<flags>0</flags><br/>
</java.util.regex.Pattern>
</td>
<td>Available with Java 1.4 or higher.</td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.util.concurrent.atomic">java.util.concurrent.atomic</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/AtomicBooleanConverter.html">AtomicBooleanConverter</a></td>
<td>java.util.concurrent.atomic.AtomicBoolean</td>
<td class="example">
<atomic-boolean>true</atomic-boolean>
</td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/AtomicIntegerConverter.html">AtomicIntegerConverter</a></td>
<td>java.util.concurrent.atomic.AtomicInteger</td>
<td class="example">
<atomic-integer>12345678</atomic-integer>
</td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/AtomicLongConverter.html">AtomicLongConverter</a></td>
<td>java.util.concurrent.atomic.AtomicLong</td>
<td class="example">
<atomic-long>2344556678888786</atomic-long>
</td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/AtomicReferenceConverter.html">AtomicReferenceConverter</a></td>
<td>java.util.concurrent.atomic.AtomicReference</td>
<td class="example">
<atomic-reference><br/>
<value class="string">test</value><br/>
</atomic-reference>
</td>
<td>Available with Java 1.5 or higher.</td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.time">java.time</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/DurationConverter.html">DurationConverter</a></td>
<td>java.time.Duration</td>
<td class="example">
<duration>PT24000H</duration>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/InstantConverter.html">InstantConverter</a></td>
<td>java.time.Instant</td>
<td class="example">
<instant>2017-07-30T20:40:00Z</instant>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/LocalDateConverter.html">LocalDateConverter</a></td>
<td>java.time.LocalDate</td>
<td class="example">
<local-date>2017-10-30</local-date>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/LocalDateTimeConverter.html">LocalDateTimeConverter</a></td>
<td>java.time.LocalDateTime</td>
<td class="example">
<local-date-time>2017-10-30T20:40:15</local-date-time>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/LocalTimeConverter.html">LocalTimeConverter</a></td>
<td>java.time.LocalTime</td>
<td class="example">
<local-time>20:40:15</local-time>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/MonthDayConverter.html">MonthDayConverter</a></td>
<td>java.time.MonthDay</td>
<td class="example">
<month-day>--01-13</month-day>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/OffsetDateTimeConverter.html">OffsetDateTimeConverter</a></td>
<td>java.time.OffsetDateTime</td>
<td class="example">
<offset-date-time>2017-07-30T20:40:00Z</offset-date-time>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/OffsetTimeConverter.html">OffsetTimeConverter</a></td>
<td>java.time.OffsetTime</td>
<td class="example">
<offset-time>20:40:15+01:00</offset-time>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/PeriodConverter.html">PeriodConverter</a></td>
<td>java.time.Period</td>
<td class="example">
<period>P1000D</period>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/SystemClockConverter.html">SystemClockConverter</a></td>
<td>java.time.Clock$SystemClock</td>
<td class="example">
<system-clock>
<zone>Europe/Berlin</zone>
</system-clock>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/YearConverter.html">YearConverter</a></td>
<td>java.time.Year</td>
<td class="example">
<year>2017</year>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/YearMonthConverter.html">YearMonthConverter</a></td>
<td>java.time.YearMonth</td>
<td class="example">
<year-month>2017-02</year-month>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/ZonedDateTimeConverter.html">ZonedDateTimeConverter</a></td>
<td>java.time.ZonedDateTime</td>
<td class="example">
<zoned-date-time>2017-10-30T20:40:00Z[Europe/London]</zoned-date-time>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/ZoneIdConverter.html">ZoneIdConverter</a></td>
<td>java.time.ZoneId<br/>java.time.ZoneOffset<br/>java.time.ZoneRegion</td>
<td class="example">
<zone-id>Z</zone-id>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.time.chrono">java.time.chrono</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/ChronologyConverter.html">ChronologyConverter</a></td>
<td>java.time.chrono.Chronology implementations</td>
<td class="example">
<chronology>ISO</chronology>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/HijrahDateConverter.html">HijrahDateConverter</a></td>
<td>java.time.chrono.HijrahDate</td>
<td class="example">
<hijrah-date>Hijrah-umalqura AH 1438-11-07</hijrah-date>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/JapaneseDateConverter.html">JapaneseDateConverter</a></td>
<td>java.time.chrono.JapaneseDate</td>
<td class="example">
<japanese-date>Japanese Heisei 29-07-30</japanese-date>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/JapaneseEraConverter.html">JapaneseEraConverter</a></td>
<td>java.time.chrono.JapaneseEra</td>
<td class="example">
<japanese-era>Taisho</japanese-era>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/MinguoDateConverter.html">MinguoDateConverter</a></td>
<td>java.time.chrono.MinguoDate</td>
<td class="example">
<minguo-date>Minguo ROC 106-07-30</minguo-date>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/ThaiBuddhistDateConverter.html">ThaiBuddhistDateConverter</a></td>
<td>java.time.chrono.ThaiBuddhistDate</td>
<td class="example">
<thai-buddhist-date>haiBuddhist BE 2560-07-30</thai-buddhist-date>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.time.temporal">java.time.temporal</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/ValueRangeConverter.html">ValueRangeConverter</a></td>
<td>java.time.temporal.ValueRange</td>
<td class="example">
<temporal-value-range><br/>
<maxLargest>45</maxLargest><br/>
<maxSmallest>30</maxSmallest><br/>
<minLargest>1</minLargest><br/>
<minSmallest>0</minSmallest><br/>
</temporal-value-range>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/time/WeekFieldsConverter.html">WeekFieldsConverter</a></td>
<td>java.time.temporal.WeekFields</td>
<td class="example">
<week-fields><br/>
<minimalDays>2</minimalDays><br/>
<firstDayOfWeek>MONDAY</firstDayOfWeek><br/>
</week-fields>
</td>
<td>Available with Java 8 or higher.</td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.sql">java.sql</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/SqlDateConverter.html">SqlDateConverter</a></td>
<td>java.sql.Date</td>
<td class="example"><sql-date>1978-08-25</sql-date></td>
<td>Only automatically registered if runtime has JDBC support.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/SqlTimeConverter.html">SqlTimeConverter</a></td>
<td>java.sql.Time</td>
<td class="example"><sql-time>14:07:33</sql-time></td>
<td>Only automatically registered if runtime has JDBC support.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/SqlTimestampConverter.html">SqlTimestampConverter</a></td>
<td>java.sql.Timestamp</td>
<td class="example"><sql-timestamp>1970-01-01 00:00:01.234</sql-timestamp></td>
<td>Only automatically registered if runtime has JDBC support.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/ISO8601SqlTimestampConverter.html">ISO8601SqlTimestampConverter</a></td>
<td>java.sql.Timestamp</td>
<td class="example"><sql-timestamp>2006-07-28T12:06:17.654000000-03:00</sql-timestamp></td>
<td>Not automatically registered, can be used globally or locally. Implementation needs joda-time for JDK 1.7 or below.</td>
<td> </td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.math">java.math</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/BigDecimalConverter.html">BigDecimalConverter</a></td>
<td>java.math.BigDecimal</td>
<td class="example"><big-decimal>342346.445332</big-decimal></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/BigIntegerConverter.html">BigIntegerConverter</a></td>
<td>java.math.BigInteger</td>
<td class="example"><big-int>23434224556</big-int></td>
<td> </td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.net">java.net</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/URIConverter.html">URIConverter</a></td>
<td>java.net.URI</td>
<td class="example"><uri>mailto:xstream-user.codehaus.org</uri></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/basic/URLConverter.html">URLConverter</a></td>
<td>java.net.URL</td>
<td class="example"><url>http://codehaus.org/blah</url></td>
<td> </td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.io">java.io</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/FileConverter.html">FileConverter</a></td>
<td>java.io.File</td>
<td class="example"><file>/stuff/hello.txt</file></td>
<td> </td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/reflection/SerializableConverter.html">SerializableConverter</a></td>
<td>java.io.Serializable</td>
<td> </td>
<td>See description at Generalized Converters.</td>
<td>low</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.html">ExternalizableConverter</a></td>
<td>java.io.Externalizable</td>
<td class="example">
<<i>externalizable-type</i>><br/>
<string>apple</string><br/>
<int>42</int><br/>
<big-decimal>12345.4555</big-decimal><br/>
</<i>externalizable-type</i>>
</td>
<td>See description at Generalized Converters.</td>
<td>low</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.nio">java.nio</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/CharsetConverter.html">CharsetConverter</a></td>
<td>java.nio.charset.Charset</td>
<td class="example"><charset>US-ASCII</charset></td>
<td>Available with Java 1.4 or higher.</td>
<td>normal</td>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/PathConverter.html">PathConverter</a></td>
<td>java.nio.file.Path</td>
<td class="example"><path>../dir/file.txt</path></td>
<td>Available with Java 7 or higher.</td>
<td>normal</td>
</tr>
<!-- .................................................................................................. -->
<tr>
<td colspan="5" class="headerRow"><h1 id="java.lang.reflect">java.lang.reflect</h1></td>
</tr>
<tr>
<th>Converter</th>
<th>Supported types</th>
<th>Example</th>
<th>Notes</th>
<th>Prio</th>
</tr>
<tr>
<td><a href="javadoc/com/thoughtworks/xstream/converters/extended/JavaClassConverter.html">JavaClassConverter</a></td>
<td>java.lang.Class</td>
<td class="example"><class>com.foo.MyThing</class></td>
<td>This converter uses the ClassLoaderReference of the XStream instance. Can be registered with
Mapper globally or locally to respect type aliases.</td>
<td>normal</td>
</tr>