Package list libxstream-java / 98bc0c1
Imported Upstream version 1.4.8 Emmanuel Bourg 6 years ago
715 changed file(s) with 92161 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 For Java 5 or higher build with Maven 2.2 or 3
1 For Java 1.4 build with Maven 2.0.11
2
3 Before building:
4
5 To build:
6
7 mvn clean install
8
9 Before deploying:
10
11 copy settings-template.xml to ~/.m2/settings.xml adding your Codehaus DAV username and passwords.
12
13 To deploy (optionally adding sources and javadoc jars):
14 mvn deploy
0 (BSD Style License)
1
2 Copyright (c) 2003-2006, Joe Walnes
3 Copyright (c) 2006-2011, XStream Committers
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8
9 Redistributions of source code must retain the above copyright notice, this list of
10 conditions and the following disclaimer. Redistributions in binary form must reproduce
11 the above copyright notice, this list of conditions and the following disclaimer in
12 the documentation and/or other materials provided with the distribution.
13
14 Neither the name of XStream nor the names of its contributors may be used to endorse
15 or promote products derived from this software without specific prior written
16 permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
19 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
21 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
26 WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
27 DAMAGE.
0
1 ***********
2 ********************** XStream **********************
3 ***********
4
5 "Java to XML Serialization, and back again"
6
7
8 --[ Binaries ]-----------------------------------------------
9
10 All binary artifacts are in the 'lib' directory. These include the
11 xstream jars and any other library used at build time,
12 or optional runtime extras. kXML2 is recommend for use as it will
13 greatly improve the performance of XStream.
14
15 --[ Documentation ]------------------------------------------
16
17 Documentation can be found in docs/index.html. This includes:
18 * Introduction and tutorial
19 * JavaDoc
20 * Change log
21 * Frequently asked questions
22
23 --[ Source ]-------------------------------------------------
24
25 The complete source for XStream is bundled. This includes:
26 * Main API [src/java]
27 * Unit tests [src/test]
28 * Maven build files [pom.xml]
29 * Dependencies [lib]
30
31 -------------------------------------------------------------
32
33 -XStream Ccommitters
34
35 http://xstream.codehaus.org/
36
0 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1 <!--
2 Copyright (C) 2006 Joe Walnes.
3 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2015 XStream committers.
4 All rights reserved.
5
6 The software in this package is published under the terms of the BSD
7 style license a copy of which has been included with this distribution in
8 the LICENSE.txt file.
9
10 Created on 29. July 2006 by Mauro Talevi
11 -->
12 <modelVersion>4.0.0</modelVersion>
13 <parent>
14 <groupId>org.codehaus</groupId>
15 <artifactId>codehaus-parent</artifactId>
16 <version>3</version><!-- 4 required Java 5 -->
17 <relativePath />
18 </parent>
19 <groupId>com.thoughtworks.xstream</groupId>
20 <artifactId>xstream-parent</artifactId>
21 <packaging>pom</packaging>
22 <version>1.4.8</version>
23 <name>XStream Parent</name>
24 <description>
25 XStream is a serialization library from Java objects to XML and back.
26 </description>
27
28 <inceptionYear>2004</inceptionYear>
29 <organization>
30 <name>XStream</name>
31 <url>http://xstream.codehaus.org</url>
32 </organization>
33
34 <profiles>
35 <profile>
36 <id>jdk19</id>
37 <activation>
38 <jdk>1.9</jdk>
39 </activation>
40 <properties>
41 <version.java.source>1.6</version.java.source>
42 <version.java.target>1.6</version.java.target>
43 </properties>
44 </profile>
45 <profile>
46 <id>jdk18ge</id>
47 <activation>
48 <jdk>[1.8,)</jdk>
49 </activation>
50 <properties>
51 <javadoc.xdoclint>-Xdoclint:-missing</javadoc.xdoclint>
52 </properties>
53 </profile>
54 <profile>
55 <id>jdk15-ge</id>
56 <activation>
57 <jdk>[1.5,)</jdk>
58 </activation>
59 <build>
60 <plugins>
61 <plugin>
62 <groupId>org.apache.felix</groupId>
63 <artifactId>maven-bundle-plugin</artifactId>
64 <executions>
65 <execution>
66 <id>bundle-manifest</id>
67 <phase>process-classes</phase>
68 <goals>
69 <goal>manifest</goal>
70 </goals>
71 </execution>
72 </executions>
73 </plugin>
74 </plugins>
75 </build>
76 <modules>
77 <!--module>xstream-builder</module-->
78 </modules>
79 </profile>
80 <profile>
81 <id>jdk15</id>
82 <activation>
83 <jdk>1.5</jdk>
84 </activation>
85 <properties>
86 <version.hsqldb>1.8.0.10</version.hsqldb>
87 <version.org.hibernate.core>3.6.6.Final</version.org.hibernate.core>
88 </properties>
89 </profile>
90 <profile>
91 <!-- build with Maven 2.0.10 !!! -->
92 <id>jdk14</id>
93 <activation>
94 <jdk>1.4</jdk>
95 </activation>
96 <properties>
97 <version.java.source>1.3</version.java.source>
98 <version.java.target>1.3</version.java.target>
99 <link.javadoc.javase>http://docs.oracle.com/javase/1.4.2/docs/api/</link.javadoc.javase>
100 <!-- repeat Hibernate version dependencies, JDK intervals in activation is not supported with M2.0.x -->
101 <version.hsqldb>1.8.0.10</version.hsqldb>
102 <version.org.hibernate.core>3.3.2.GA</version.org.hibernate.core>
103 <version.org.hibernate.envers>3.6.6.Final</version.org.hibernate.envers><!-- not usable with JDK 1.4 -->
104 </properties>
105 </profile>
106 <profile>
107 <id>java</id>
108 <activation>
109 <file>
110 <exists>src/java</exists>
111 </file>
112 </activation>
113 <build>
114 <plugins>
115 <plugin>
116 <groupId>org.apache.maven.plugins</groupId>
117 <artifactId>maven-enforcer-plugin</artifactId>
118 <!-- overwrite codehaus-parent -->
119 <version>${version.plugin.maven.enforcer}</version>
120 <executions>
121 <execution>
122 <id>enforce-java-version</id>
123 <goals>
124 <goal>enforce</goal>
125 </goals>
126 <configuration>
127 <rules>
128 <requireJavaVersion>
129 <version>${version.java.enforced}</version>
130 </requireJavaVersion>
131 </rules>
132 </configuration>
133 </execution>
134 </executions>
135 </plugin>
136 </plugins>
137 </build>
138 </profile>
139 <profile>
140 <id>xstream-release</id>
141 <properties>
142 <version.java.enforced>[1.8,1.9)</version.java.enforced>
143 </properties>
144 <build>
145 <plugins>
146 <plugin>
147 <groupId>org.apache.maven.plugins</groupId>
148 <artifactId>maven-gpg-plugin</artifactId>
149 <executions>
150 <execution>
151 <id>sign-artifacts</id>
152 <phase>verify</phase>
153 <goals>
154 <goal>sign</goal>
155 </goals>
156 </execution>
157 </executions>
158 </plugin>
159 </plugins>
160 </build>
161 </profile>
162 </profiles>
163
164 <modules>
165 <module>xstream</module>
166 <module>xstream-hibernate</module>
167 <module>xstream-benchmark</module>
168 <module>xstream-distribution</module>
169 </modules>
170
171 <licenses>
172 <license>
173 <name>BSD style</name>
174 <url>http://xstream.codehaus.org/license.html</url>
175 <distribution>repo</distribution>
176 </license>
177 </licenses>
178
179 <dependencyManagement>
180 <dependencies>
181 <dependency>
182 <groupId>com.thoughtworks.xstream</groupId>
183 <artifactId>xstream</artifactId>
184 <version>1.4.8</version>
185 </dependency>
186 <dependency>
187 <groupId>com.thoughtworks.xstream</groupId>
188 <artifactId>xstream</artifactId>
189 <version>1.4.8</version>
190 <classifier>tests</classifier>
191 <type>test-jar</type>
192 <scope>test</scope>
193 </dependency>
194 <dependency>
195 <groupId>com.thoughtworks.xstream</groupId>
196 <artifactId>xstream</artifactId>
197 <version>1.4.8</version>
198 <classifier>javadoc</classifier>
199 <scope>provided</scope>
200 </dependency>
201 <dependency>
202 <groupId>com.thoughtworks.xstream</groupId>
203 <artifactId>xstream-hibernate</artifactId>
204 <version>1.4.8</version>
205 </dependency>
206 <dependency>
207 <groupId>com.thoughtworks.xstream</groupId>
208 <artifactId>xstream-hibernate</artifactId>
209 <version>1.4.8</version>
210 <classifier>javadoc</classifier>
211 <scope>provided</scope>
212 </dependency>
213 <dependency>
214 <groupId>com.thoughtworks.xstream</groupId>
215 <artifactId>xstream-benchmark</artifactId>
216 <version>1.4.8</version>
217 </dependency>
218 <dependency>
219 <groupId>com.thoughtworks.xstream</groupId>
220 <artifactId>xstream-benchmark</artifactId>
221 <version>1.4.8</version>
222 <classifier>javadoc</classifier>
223 <scope>provided</scope>
224 </dependency>
225
226 <dependency>
227 <groupId>commons-io</groupId>
228 <artifactId>commons-io</artifactId>
229 <version>${version.commons.io}</version>
230 </dependency>
231
232 <dependency>
233 <groupId>commons-cli</groupId>
234 <artifactId>commons-cli</artifactId>
235 <version>${version.commons.cli}</version>
236 </dependency>
237
238 <dependency>
239 <groupId>commons-lang</groupId>
240 <artifactId>commons-lang</artifactId>
241 <version>${version.commons.lang}</version>
242 </dependency>
243
244 <dependency>
245 <groupId>cglib</groupId>
246 <artifactId>cglib-nodep</artifactId>
247 <version>${version.cglib.nodep}</version>
248 </dependency>
249 <dependency>
250 <groupId>javassist</groupId>
251 <artifactId>javassist</artifactId>
252 <version>${version.javaassist}</version>
253 </dependency>
254
255 <dependency>
256 <groupId>dom4j</groupId>
257 <artifactId>dom4j</artifactId>
258 <version>${version.dom4j}</version>
259 <exclusions>
260 <exclusion>
261 <groupId>xml-apis</groupId>
262 <artifactId>xml-apis</artifactId>
263 </exclusion>
264 </exclusions>
265 </dependency>
266
267 <dependency>
268 <groupId>org.jdom</groupId>
269 <artifactId>jdom</artifactId>
270 <version>${version.org.jdom}</version>
271 </dependency>
272 <dependency>
273 <groupId>org.jdom</groupId>
274 <artifactId>jdom2</artifactId>
275 <version>${version.org.jdom2}</version>
276 </dependency>
277
278 <dependency>
279 <groupId>joda-time</groupId>
280 <artifactId>joda-time</artifactId>
281 <version>${version.joda-time}</version>
282 </dependency>
283
284 <dependency>
285 <groupId>com.megginson.sax</groupId>
286 <artifactId>xml-writer</artifactId>
287 <version>${version.com.megginson.sax.xml-writer}</version>
288 <exclusions>
289 <exclusion>
290 <groupId>xml-apis</groupId>
291 <artifactId>xml-apis</artifactId>
292 </exclusion>
293 </exclusions>
294 </dependency>
295
296 <dependency>
297 <groupId>stax</groupId>
298 <artifactId>stax</artifactId>
299 <version>${version.stax}</version>
300 </dependency>
301 <dependency>
302 <groupId>stax</groupId>
303 <artifactId>stax-api</artifactId>
304 <version>${version.stax.api}</version>
305 </dependency>
306
307 <dependency>
308 <groupId>org.codehaus.woodstox</groupId>
309 <artifactId>wstx-asl</artifactId>
310 <version>${version.org.codehaus.woodstox.asl}</version>
311 </dependency>
312
313 <dependency>
314 <groupId>xom</groupId>
315 <artifactId>xom</artifactId>
316 <version>${version.xom}</version>
317 <exclusions>
318 <exclusion>
319 <groupId>xerces</groupId>
320 <artifactId>xmlParserAPIs</artifactId>
321 </exclusion>
322 <exclusion>
323 <groupId>xerces</groupId>
324 <artifactId>xercesImpl</artifactId>
325 </exclusion>
326 <exclusion>
327 <groupId>xalan</groupId>
328 <artifactId>xalan</artifactId>
329 </exclusion>
330 <exclusion>
331 <groupId>jaxen</groupId>
332 <artifactId>jaxen</artifactId>
333 </exclusion>
334 </exclusions>
335 </dependency>
336
337 <dependency>
338 <groupId>xpp3</groupId>
339 <artifactId>xpp3_min</artifactId>
340 <version>${version.xpp3}</version>
341 </dependency>
342 <dependency>
343 <groupId>net.sf.kxml</groupId>
344 <artifactId>kxml2-min</artifactId>
345 <version>${version.net.sf.kxml.kxml2}</version>
346 </dependency>
347 <dependency>
348 <groupId>net.sf.kxml</groupId>
349 <artifactId>kxml2</artifactId>
350 <version>${version.net.sf.kxml.kxml2}</version>
351 </dependency>
352 <dependency>
353 <groupId>xmlpull</groupId>
354 <artifactId>xmlpull</artifactId>
355 <version>${version.xmlpull}</version>
356 </dependency>
357
358 <dependency>
359 <groupId>oro</groupId>
360 <artifactId>oro</artifactId>
361 <version>${version.oro}</version>
362 </dependency>
363
364 <dependency>
365 <groupId>org.json</groupId>
366 <artifactId>json</artifactId>
367 <version>${version.org.json}</version>
368 </dependency>
369
370 <dependency>
371 <groupId>org.codehaus.jettison</groupId>
372 <artifactId>jettison</artifactId>
373 <version>${version.org.codehaus.jettison}</version>
374 </dependency>
375
376 <dependency>
377 <groupId>xml-apis</groupId>
378 <artifactId>xml-apis</artifactId>
379 <version>${version.xml-apis}</version>
380 </dependency>
381
382 <dependency>
383 <groupId>xerces</groupId>
384 <artifactId>xercesImpl</artifactId>
385 <version>${version.xerces.impl}</version>
386 </dependency>
387
388 <dependency>
389 <groupId>org.hibernate</groupId>
390 <artifactId>hibernate-core</artifactId>
391 <version>${version.org.hibernate.core}</version>
392 </dependency>
393 <dependency>
394 <groupId>org.hibernate</groupId>
395 <artifactId>hibernate-envers</artifactId>
396 <version>${version.org.hibernate.envers}</version>
397 <exclusions>
398 <exclusion>
399 <groupId>cglib</groupId>
400 <artifactId>cglib</artifactId>
401 </exclusion>
402 </exclusions>
403 </dependency>
404 <dependency>
405 <groupId>org.hsqldb</groupId>
406 <artifactId>hsqldb</artifactId>
407 <version>${version.hsqldb}</version>
408 </dependency>
409 <dependency>
410 <groupId>org.slf4j</groupId>
411 <artifactId>slf4j-api</artifactId>
412 <version>${version.org.slf4j}</version>
413 <scope>runtime</scope>
414 </dependency>
415 <dependency>
416 <groupId>org.slf4j</groupId>
417 <artifactId>slf4j-simple</artifactId>
418 <version>${version.org.slf4j}</version>
419 <scope>runtime</scope>
420 </dependency>
421
422 <!-- always test-scoped -->
423 <dependency>
424 <groupId>junit</groupId>
425 <artifactId>junit</artifactId>
426 <version>${version.junit}</version>
427 <scope>test</scope>
428 </dependency>
429
430 <dependency>
431 <groupId>jmock</groupId>
432 <artifactId>jmock</artifactId>
433 <version>${version.jmock}</version>
434 <scope>test</scope>
435 </dependency>
436
437 </dependencies>
438 </dependencyManagement>
439
440 <build>
441 <sourceDirectory>${basedir}/src/java</sourceDirectory>
442 <resources>
443 <resource>
444 <directory>${basedir}/src/java</directory>
445 <includes>
446 <include>**/*.properties</include>
447 <include>**/*.xml</include>
448 </includes>
449 </resource>
450 </resources>
451 <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
452 <testResources>
453 <testResource>
454 <directory>${basedir}/src/test</directory>
455 <includes>
456 <include>**/*.xml</include>
457 <include>**/*.xsl</include>
458 <include>**/*.txt</include>
459 </includes>
460 </testResource>
461 </testResources>
462 <pluginManagement>
463 <plugins>
464 <plugin>
465 <groupId>org.apache.maven.plugins</groupId>
466 <artifactId>maven-antrun-plugin</artifactId>
467 <version>${version.plugin.maven.antrun}</version>
468 </plugin>
469 <plugin>
470 <groupId>org.apache.maven.plugins</groupId>
471 <artifactId>maven-assembly-plugin</artifactId>
472 <version>${version.plugin.maven.assembly}</version>
473 </plugin>
474 <plugin>
475 <groupId>org.apache.maven.plugins</groupId>
476 <artifactId>maven-clean-plugin</artifactId>
477 <version>${version.plugin.maven.clean}</version>
478 </plugin>
479 <plugin>
480 <groupId>org.apache.maven.plugins</groupId>
481 <artifactId>maven-compiler-plugin</artifactId>
482 <version>${version.plugin.maven.compiler}</version>
483 <configuration>
484 <source>${version.java.source}</source>
485 <target>${version.java.target}</target>
486 </configuration>
487 </plugin>
488 <plugin>
489 <groupId>org.apache.maven.plugins</groupId>
490 <artifactId>maven-dependency-plugin</artifactId>
491 <version>${version.plugin.maven.dependency}</version>
492 </plugin>
493 <plugin>
494 <groupId>org.apache.maven.plugins</groupId>
495 <artifactId>maven-deploy-plugin</artifactId>
496 <version>${version.plugin.maven.deploy}</version>
497 </plugin>
498 <plugin>
499 <groupId>org.apache.maven.plugins</groupId>
500 <artifactId>maven-eclipse-plugin</artifactId>
501 <configuration>
502 <downloadSources>true</downloadSources>
503 <projectNameTemplate>[artifactId]-1.4.x</projectNameTemplate>
504 </configuration>
505 </plugin>
506 <plugin>
507 <groupId>org.apache.maven.plugins</groupId>
508 <artifactId>maven-enforcer-plugin</artifactId>
509 <version>${version.plugin.maven.enforcer}</version>
510 </plugin>
511 <plugin>
512 <groupId>org.apache.maven.plugins</groupId>
513 <artifactId>maven-gpg-plugin</artifactId>
514 <version>${version.plugin.maven.gpg}</version>
515 </plugin>
516 <plugin>
517 <groupId>org.apache.maven.plugins</groupId>
518 <artifactId>maven-install-plugin</artifactId>
519 <version>${version.plugin.maven.install}</version>
520 </plugin>
521 <plugin>
522 <groupId>org.apache.maven.plugins</groupId>
523 <artifactId>maven-jar-plugin</artifactId>
524 <version>${version.plugin.maven.jar}</version>
525 <configuration>
526 <archive>
527 <manifest>
528 <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
529 <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
530 </manifest>
531 <manifestEntries>
532 <Specification-Version>${project.info.majorVersion}.${project.info.minorVersion}</Specification-Version>
533 <X-Compile-Source>${version.java.source}</X-Compile-Source>
534 <X-Compile-Target>${version.java.target}</X-Compile-Target>
535 <X-Builder>Maven ${maven.version}</X-Builder>
536 <X-Build-Time>${maven.build.timestamp}</X-Build-Time>
537 <X-Build-Os>${os.name}</X-Build-Os>
538 </manifestEntries>
539 </archive>
540 </configuration>
541 </plugin>
542 <plugin>
543 <groupId>org.apache.maven.plugins</groupId>
544 <artifactId>maven-javadoc-plugin</artifactId>
545 <version>${version.plugin.maven.javadoc}</version>
546 <executions>
547 <execution>
548 <id>attach-javadocs</id>
549 <goals>
550 <goal>jar</goal>
551 </goals>
552 </execution>
553 </executions>
554 <configuration>
555 <detectJavaApiLink>false</detectJavaApiLink>
556 <additionalparam>${javadoc.xdoclint}</additionalparam>
557 <source>${version.java.source}</source>
558 <links>
559 <link>${link.javadoc.javase}</link>
560 </links>
561 <archive>
562 <manifest>
563 <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
564 <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
565 </manifest>
566 <manifestEntries>
567 <Specification-Version>${project.info.majorVersion}.${project.info.minorVersion}</Specification-Version>
568 </manifestEntries>
569 </archive>
570 </configuration>
571 </plugin>
572 <plugin>
573 <groupId>org.apache.maven.plugins</groupId>
574 <artifactId>maven-release-plugin</artifactId>
575 <version>${version.plugin.maven.release}</version>
576 <configuration>
577 <goals>deploy</goals>
578 <autoVersionSubmodules>true</autoVersionSubmodules>
579 <!-- overwrite codehaus-parent -->
580 <arguments>-Pxstream-release</arguments>
581 </configuration>
582 </plugin>
583 <plugin>
584 <groupId>org.apache.maven.plugins</groupId>
585 <artifactId>maven-resources-plugin</artifactId>
586 <version>${version.plugin.maven.resources}</version>
587 </plugin>
588 <plugin>
589 <groupId>org.apache.maven.plugins</groupId>
590 <artifactId>maven-site-plugin</artifactId>
591 <version>${version.plugin.maven.site}</version>
592 </plugin>
593 <plugin>
594 <groupId>org.apache.maven.plugins</groupId>
595 <artifactId>maven-source-plugin</artifactId>
596 <version>${version.plugin.maven.source}</version>
597 <executions>
598 <execution>
599 <id>attach-sources</id>
600 <phase>package</phase>
601 <goals>
602 <goal>jar-no-fork</goal>
603 </goals>
604 </execution>
605 </executions>
606 <configuration>
607 <archive>
608 <manifest>
609 <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
610 <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
611 </manifest>
612 <manifestEntries>
613 <Specification-Version>${project.info.majorVersion}.${project.info.minorVersion}</Specification-Version>
614 <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
615 <Bundle-Name>${project.name} Sources</Bundle-Name>
616 <Bundle-SymbolicName>${project.artifactId}.sources</Bundle-SymbolicName>
617 <Bundle-Vendor>${project.organization.name} Sources</Bundle-Vendor>
618 <Bundle-Version>${project.info.osgiVersion} Sources</Bundle-Version>
619 <Eclipse-SourceBundle>${project.artifactId};version=${project.info.osgiVersion}</Eclipse-SourceBundle>
620 <X-Compile-Source>${version.java.source}</X-Compile-Source>
621 <X-Compile-Target>${version.java.target}</X-Compile-Target>
622 <X-Builder>Maven ${maven.version}</X-Builder>
623 <X-Build-Time>${maven.build.timestamp}</X-Build-Time>
624 <X-Build-Os>${os.name}</X-Build-Os>
625 </manifestEntries>
626 </archive>
627 </configuration>
628 </plugin>
629 <plugin>
630 <groupId>org.apache.maven.plugins</groupId>
631 <artifactId>maven-surefire-plugin</artifactId>
632 <version>${version.plugin.maven.surefire}</version>
633 <configuration>
634 <forkMode>once</forkMode>
635 <printSummary>true</printSummary>
636 <useFile>false</useFile>
637 <includes>
638 <include>**/*Test.java</include>
639 <include>**/*TestSuite.java</include>
640 </includes>
641 <excludes>
642 <exclude>**/Abstract*Test.java</exclude>
643 <exclude>**/*$*.java</exclude>
644 </excludes>
645 <systemProperties>
646 <property>
647 <name>java.awt.headless</name>
648 <value>true</value>
649 </property>
650 </systemProperties>
651 </configuration>
652 </plugin>
653 <plugin>
654 <groupId>org.apache.maven.plugins</groupId>
655 <artifactId>maven-surefire-report-plugin</artifactId>
656 <version>${version.plugin.maven.surefire}</version>
657 </plugin>
658 <plugin>
659 <groupId>org.codehaus.mojo</groupId>
660 <artifactId>build-helper-maven-plugin</artifactId>
661 <version>${version.plugin.mojo.build-helper}</version>
662 </plugin>
663 <plugin>
664 <groupId>org.codehaus.mojo</groupId>
665 <artifactId>cobertura-maven-plugin</artifactId>
666 <version>${version.plugin.mojo.cobertura}</version>
667 <executions>
668 <execution>
669 <goals>
670 <goal>clean</goal>
671 </goals>
672 </execution>
673 </executions>
674 </plugin>
675 <plugin>
676 <groupId>org.codehaus.mojo</groupId>
677 <artifactId>jxr-maven-plugin</artifactId>
678 <version>${version.plugin.mojo.jxr}</version>
679 </plugin>
680 <plugin>
681 <groupId>org.codehaus.xsite</groupId>
682 <artifactId>xsite-maven-plugin</artifactId>
683 <version>${version.plugin.codehaus.xsite}</version>
684 </plugin>
685 <plugin>
686 <groupId>org.apache.felix</groupId>
687 <artifactId>maven-bundle-plugin</artifactId>
688 <version>${version.plugin.felix.bundle}</version>
689 <configuration>
690 <manifestLocation>${project.build.directory}/OSGi</manifestLocation>
691 <instructions>
692 <_nouses>true</_nouses>
693 <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
694 <Specification-Version>${project.info.majorVersion}.${project.info.minorVersion}</Specification-Version><!-- FELIX-3392 -->
695 </instructions>
696 <archive>
697 <manifest>
698 <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries><!-- FELIX-3392 -->
699 </manifest>
700 </archive>
701 </configuration>
702 </plugin>
703 </plugins>
704 </pluginManagement>
705 <plugins>
706 <plugin>
707 <groupId>org.codehaus.mojo</groupId>
708 <artifactId>build-helper-maven-plugin</artifactId>
709 <executions>
710 <execution>
711 <id>versions</id>
712 <phase>initialize</phase>
713 <goals>
714 <goal>maven-version</goal>
715 <goal>parse-version</goal>
716 </goals>
717 <configuration>
718 <propertyPrefix>project.info</propertyPrefix>
719 </configuration>
720 </execution>
721 </executions>
722 </plugin>
723 <plugin>
724 <groupId>org.apache.maven.plugins</groupId>
725 <artifactId>maven-release-plugin</artifactId>
726 <configuration>
727 <tagBase>https://svn.codehaus.org/xstream/tags</tagBase>
728 </configuration>
729 </plugin>
730 </plugins>
731 <extensions>
732 <extension>
733 <groupId>org.apache.maven.wagon</groupId>
734 <artifactId>wagon-webdav</artifactId>
735 <version>${version.org.apache.maven.wagon.webdev}</version>
736 </extension>
737 </extensions>
738 </build>
739
740 <distributionManagement>
741 <!--
742 The server id codehaus-nexus-snapshots, codehaus-nexus-staging, and
743 codehaus.org must appear ~/.m2/settings.xml cf. settings-template.xml.
744 http://hausmates.codehaus.org/Codehaus+Maven+Repository+Usage+Guide
745 -->
746 <site>
747 <id>codehaus.org</id>
748 <name>Codehaus XStream Site</name>
749 <url>dav:https://dav.codehaus.org/xstream</url>
750 </site>
751 </distributionManagement>
752
753 <scm>
754 <connection>scm:svn:http://svn.codehaus.org/xstream/tags/XSTREAM_1_4_8</connection>
755 <developerConnection>scm:svn:https://svn.codehaus.org/xstream/tags/XSTREAM_1_4_8</developerConnection>
756 <url>http://fisheye.codehaus.org/browse/xstream/tags/XSTREAM_1_4_8</url>
757 </scm>
758
759 <properties>
760 <version.java.source>1.5</version.java.source>
761 <version.java.target>1.5</version.java.target>
762 <version.java.enforced>[1.4,)</version.java.enforced>
763
764 <version.plugin.codehaus.xsite>1.2.1</version.plugin.codehaus.xsite>
765 <version.plugin.felix.bundle>2.3.7</version.plugin.felix.bundle>
766 <version.plugin.maven.antrun>1.1</version.plugin.maven.antrun>
767 <version.plugin.maven.assembly>2.1</version.plugin.maven.assembly>
768 <version.plugin.maven.clean>2.2</version.plugin.maven.clean>
769 <version.plugin.maven.compiler>2.1</version.plugin.maven.compiler><!-- JDK 1.4 compatible -->
770 <version.plugin.maven.dependency>2.1</version.plugin.maven.dependency>
771 <version.plugin.maven.deploy>2.3</version.plugin.maven.deploy>
772 <version.plugin.maven.enforcer>1.4</version.plugin.maven.enforcer>
773 <version.plugin.maven.gpg>1.4</version.plugin.maven.gpg>
774 <version.plugin.maven.install>2.2</version.plugin.maven.install>
775 <version.plugin.maven.jar>2.2</version.plugin.maven.jar>
776 <version.plugin.maven.javadoc>2.10</version.plugin.maven.javadoc>
777 <version.plugin.maven.release>2.1</version.plugin.maven.release>
778 <version.plugin.maven.resources>2.2</version.plugin.maven.resources>
779 <version.plugin.maven.site>2.0-beta-6</version.plugin.maven.site>
780 <version.plugin.maven.source>2.1.2</version.plugin.maven.source>
781 <version.plugin.maven.surefire>2.4.3</version.plugin.maven.surefire>
782 <version.plugin.mojo.build-helper>1.5</version.plugin.mojo.build-helper>
783 <version.plugin.mojo.cobertura>2.0</version.plugin.mojo.cobertura>
784 <version.plugin.mojo.jxr>2.0-beta-1</version.plugin.mojo.jxr>
785
786 <version.org.apache.maven.wagon.webdev>1.0-beta-2</version.org.apache.maven.wagon.webdev>
787
788 <version.cglib.nodep>2.2</version.cglib.nodep>
789 <version.com.megginson.sax.xml-writer>0.2</version.com.megginson.sax.xml-writer>
790 <version.commons.cli>1.1</version.commons.cli>
791 <version.commons.io>1.4</version.commons.io>
792 <version.commons.lang>2.4</version.commons.lang>
793 <version.dom4j>1.6.1</version.dom4j>
794 <version.hsqldb>2.2.8</version.hsqldb>
795 <version.javaassist>3.12.1.GA</version.javaassist>
796 <version.jmock>1.0.1</version.jmock>
797 <version.joda-time>1.6</version.joda-time>
798 <version.junit>3.8.1</version.junit>
799 <version.net.sf.kxml.kxml2>2.3.0</version.net.sf.kxml.kxml2>
800 <version.org.codehaus.jettison>1.2</version.org.codehaus.jettison>
801 <version.org.codehaus.woodstox.asl>3.2.7</version.org.codehaus.woodstox.asl>
802 <version.org.hibernate.core>4.2.5.Final</version.org.hibernate.core>
803 <version.org.hibernate.envers>${version.org.hibernate.core}</version.org.hibernate.envers>
804 <version.org.jdom>1.1.3</version.org.jdom>
805 <version.org.jdom2>2.0.5</version.org.jdom2>
806 <version.org.json>20080701</version.org.json>
807 <version.org.slf4j>1.6.1</version.org.slf4j>
808 <version.oro>2.0.8</version.oro>
809 <version.stax>1.2.0</version.stax>
810 <version.stax.api>1.0.1</version.stax.api>
811 <version.xerces.impl>2.8.1</version.xerces.impl>
812 <version.xml-apis>1.3.04</version.xml-apis>
813 <version.xmlpull>1.1.3.1</version.xmlpull>
814 <version.xom>1.1</version.xom>
815 <version.xpp3>1.1.4c</version.xpp3>
816
817 <link.javadoc.javase>http://docs.oracle.com/javase/8/docs/api/</link.javadoc.javase>
818
819 <javadoc.xdoclint />
820 </properties>
821 </project>
0 <?xml version="1.0" encoding="UTF-8"?>
1 <!--
2 Copyright (C) 2006, 2007, 2010 XStream committers.
3 All rights reserved.
4
5 The software in this package is published under the terms of the BSD
6 style license a copy of which has been included with this distribution in
7 the LICENSE.txt file.
8
9 Created on 30. July 2006 by Mauro Talevi
10 -->
11 <settings>
12 <servers>
13 <server>
14 <id>codehaus-nexus-snapshots</id>
15 <username>your-xircles-id</username>
16 <password>your-xircles-pwd</password>
17 </server>
18 <server>
19 <id>codehaus-nexus-staging</id>
20 <username>your-xircles-id</username>
21 <password>your-xircles-pwd</password>
22 </server>
23 <server>
24 <id>codehaus.org</id>
25 <username></username>
26 <password></password>
27 </server>
28 </servers>
29 </settings>
0 [auto-props]
1 *.apt = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
2 *.c = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
3 *.c++ = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
4 *.cpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
5 *.cs = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
6 *.css = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
7 *.dtd = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
8 *.ent = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
9 *.fml = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
10 *.groovy = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
11 *.h = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
12 *.h++ = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
13 *.hpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
14 *.html = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
15 *.idl = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
16 *.include = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
17 *.java = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
18 *.js = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
19 *.jsp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
20 *.ldf = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
21 *.ldif = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
22 *.mak = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
23 *.mdo = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
24 *.php = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
25 *.rb = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
26 *.rtf = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
27 *.sql = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
28 *.svg = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
29 *.t2t = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
30 *.vm = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
31 *.xhtml = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
32 *.xml = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
33 *.xsd = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
34 *.xsl = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
35 *.xslt = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
36 Makefile = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
37
38 *.launch = svn:eol-style=native
39 *.MF = svn:eol-style=native
40 *.properties = svn:eol-style=native
41 *.script = svn:eol-style=native
42 *.txt = svn:eol-style=native
43
44 *.dsp = svn:eol-style=CRLF
45 *.dsw = svn:eol-style=CRLF
46
47 *.iml = svn:eol-style=LF
48
49 *.bat = svn:eol-style=CRLF;svn:executable;svn:keywords=Author Date Id HeadURL Revision
50 *.cmd = svn:eol-style=CRLF;svn:executable;svn:keywords=Author Date Id HeadURL Revision
51
52 *.ksh = svn:eol-style=LF;svn:executable;svn:keywords=Author Date Id HeadURL Revision
53 *.sh = svn:eol-style=LF;svn:executable;svn:keywords=Author Date Id HeadURL Revision
54
55 *.pl = svn:eol-style=native;svn:executable;svn:keywords=Author Date Id HeadURL Revision
56 *.py = svn:eol-style=native;svn:executable;svn:keywords=Author Date Id HeadURL Revision
57
58 *.bmp = svn:mime-type=image/bmp;svn:needs-lock=*
59 *.gif = svn:mime-type=image/gif;svn:needs-lock=*
60 *.ico = svn:mime-type=image/x-icon;svn:needs-lock=*
61 *.jpeg = svn:mime-type=image/jpeg;svn:needs-lock=*
62 *.jpg = svn:mime-type=image/jpeg;svn:needs-lock=*
63 *.png = svn:mime-type=image/png;svn:needs-lock=*
64 *.tif = svn:mime-type=image/tiff;svn:needs-lock=*
65 *.tiff = svn:mime-type=image/tiff;svn:needs-lock=*
66
67 *.doc = svn:mime-type=application/msword;svn:needs-lock=*
68 *.jar = svn:mime-type=application/octet-stream;svn:needs-lock=*
69 *.odc = svn:mime-type=application/vnd.oasis.opendocument.chart;svn:needs-lock=*
70 *.odf = svn:mime-type=application/vnd.oasis.opendocument.formula;svn:needs-lock=*
71 *.odg = svn:mime-type=application/vnd.oasis.opendocument.graphics;svn:needs-lock=*
72 *.odi = svn:mime-type=application/vnd.oasis.opendocument.image;svn:needs-lock=*
73 *.odp = svn:mime-type=application/vnd.oasis.opendocument.presentation;svn:needs-lock=*
74 *.ods = svn:mime-type=application/vnd.oasis.opendocument.spreadsheet;svn:needs-lock=*
75 *.odt = svn:mime-type=application/vnd.oasis.opendocument.text;svn:needs-lock=*
76 *.pdf = svn:mime-type=application/pdf;svn:needs-lock=*
77 *.ppt = svn:mime-type=application/vnd.ms-powerpoint;svn:needs-lock=*
78 *.ser = svn:mime-type=application/octet-stream;svn:needs-lock=*
79 *.swf = svn:mime-type=application/x-shockwave-flash;svn:needs-lock=*
80 *.vsd = svn:mime-type=application/x-visio;svn:needs-lock=*
81 *.xls = svn:mime-type=application/vnd.ms-excel;svn:needs-lock=*
82 *.zip = svn:mime-type=application/zip;svn:needs-lock=*
83
0 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1 <!--
2 Copyright (C) 2006 Joe Walnes.
3 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 XStream committers.
4 All rights reserved.
5
6 The software in this package is published under the terms of the BSD
7 style license a copy of which has been included with this distribution in
8 the LICENSE.txt file.
9
10 Created on 29. July 2006 by Mauro Talevi
11 -->
12 <modelVersion>4.0.0</modelVersion>
13 <parent>
14 <groupId>com.thoughtworks.xstream</groupId>
15 <artifactId>xstream-parent</artifactId>
16 <version>1.4.8</version>
17 </parent>
18 <artifactId>xstream</artifactId>
19 <packaging>jar</packaging>
20 <name>XStream Core</name>
21
22 <dependencies>
23 <dependency>
24 <groupId>dom4j</groupId>
25 <artifactId>dom4j</artifactId>
26 <optional>true</optional>
27 </dependency>
28
29 <dependency>
30 <groupId>org.jdom</groupId>
31 <artifactId>jdom</artifactId>
32 <optional>true</optional>
33 </dependency>
34 <dependency>
35 <groupId>org.jdom</groupId>
36 <artifactId>jdom2</artifactId>
37 <optional>true</optional>
38 </dependency>
39
40 <dependency>
41 <groupId>joda-time</groupId>
42 <artifactId>joda-time</artifactId>
43 <optional>true</optional>
44 </dependency>
45
46 <dependency>
47 <groupId>stax</groupId>
48 <artifactId>stax</artifactId>
49 <optional>true</optional>
50 </dependency>
51
52 <dependency>
53 <groupId>org.codehaus.woodstox</groupId>
54 <artifactId>wstx-asl</artifactId>
55 <optional>true</optional>
56 </dependency>
57
58 <dependency>
59 <groupId>stax</groupId>
60 <artifactId>stax-api</artifactId>
61 <optional>true</optional>
62 </dependency>
63
64 <dependency>
65 <groupId>xom</groupId>
66 <artifactId>xom</artifactId>
67 <optional>true</optional>
68 </dependency>
69
70 <dependency>
71 <groupId>xmlpull</groupId>
72 <artifactId>xmlpull</artifactId>
73 </dependency>
74
75 <dependency>
76 <groupId>net.sf.kxml</groupId>
77 <artifactId>kxml2-min</artifactId>
78 <optional>true</optional>
79 </dependency>
80
81 <dependency>
82 <groupId>net.sf.kxml</groupId>
83 <artifactId>kxml2</artifactId>
84 <optional>true</optional>
85 </dependency>
86
87 <dependency>
88 <groupId>xpp3</groupId>
89 <artifactId>xpp3_min</artifactId>
90 </dependency>
91
92 <dependency>
93 <groupId>cglib</groupId>
94 <artifactId>cglib-nodep</artifactId>
95 <optional>true</optional>
96 </dependency>
97
98 <dependency>
99 <groupId>org.codehaus.jettison</groupId>
100 <artifactId>jettison</artifactId>
101 <optional>true</optional>
102 </dependency>
103
104 <!-- test-scoped -->
105 <dependency>
106 <groupId>junit</groupId>
107 <artifactId>junit</artifactId>
108 </dependency>
109
110 <dependency>
111 <groupId>jmock</groupId>
112 <artifactId>jmock</artifactId>
113 </dependency>
114
115 <dependency>
116 <groupId>org.json</groupId>
117 <artifactId>json</artifactId>
118 <scope>test</scope>
119 </dependency>
120
121 <dependency>
122 <groupId>com.megginson.sax</groupId>
123 <artifactId>xml-writer</artifactId>
124 <scope>test</scope>
125 </dependency>
126
127 <dependency>
128 <groupId>oro</groupId>
129 <artifactId>oro</artifactId>
130 <scope>test</scope>
131 </dependency>
132
133 <dependency>
134 <groupId>commons-lang</groupId>
135 <artifactId>commons-lang</artifactId>
136 <scope>test</scope>
137 </dependency>
138 </dependencies>
139
140 <build>
141 <plugins>
142 <plugin>
143 <groupId>org.apache.maven.plugins</groupId>
144 <artifactId>maven-dependency-plugin</artifactId>
145 <executions>
146 <execution>
147 <id>complete-test-classpath</id>
148 <phase>process-test-resources</phase>
149 <goals>
150 <goal>copy</goal>
151 </goals>
152 <configuration>
153 <outputDirectory>target/lib</outputDirectory>
154 <artifactItems>
155 <artifactItem>
156 <groupId>proxytoys</groupId>
157 <artifactId>proxytoys</artifactId>
158 <version>0.2.1</version>
159 </artifactItem>
160 </artifactItems>
161 </configuration>
162 </execution>
163 <execution>
164 <id>collect-dependencies</id>
165 <phase>package</phase>
166 <goals>
167 <goal>copy-dependencies</goal>
168 </goals>
169 <configuration>
170 <outputDirectory>target/dependencies</outputDirectory>
171 <includeScope>runtime</includeScope>
172 </configuration>
173 </execution>
174 </executions>
175 </plugin>
176 <plugin>
177 <groupId>org.apache.maven.plugins</groupId>
178 <artifactId>maven-jar-plugin</artifactId>
179 <executions>
180 <execution>
181 <goals>
182 <goal>test-jar</goal>
183 </goals>
184 <configuration>
185 <includes>
186 <include>**/AbstractAcceptanceTest.*</include>
187 </includes>
188 <archive combine.children="append">
189 <manifestEntries>
190 <Specification-Title>${project.name} Test</Specification-Title>
191 <Implementation-Title>${project.name} Test</Implementation-Title>
192 </manifestEntries>
193 </archive>
194 </configuration>
195 </execution>
196 </executions>
197 </plugin>
198 </plugins>
199 </build>
200
201 <profiles>
202 <profile>
203 <id>jdk18ge</id>
204 <activation>
205 <jdk>[1.8,)</jdk>
206 </activation>
207 <build>
208 <plugins>
209 <plugin>
210 <groupId>org.apache.maven.plugins</groupId>
211 <artifactId>maven-compiler-plugin</artifactId>
212 <configuration>
213 <compilerArgs>
214 <arg>-XDignore.symbol.file</arg>
215 </compilerArgs>
216 <excludes>
217 <exclude>**/Lambda**</exclude>
218 </excludes>
219 <testExcludes>
220 <exclude>**/Lambda**</exclude>
221 </testExcludes>
222 </configuration>
223 <executions>
224 <execution>
225 <id>compile-jdk18</id>
226 <configuration>
227 <source>1.8</source>
228 <target>1.8</target>
229 <excludes>
230 <exclude>foo</exclude>
231 </excludes>
232 <testExcludes>
233 <exclude>foo</exclude>
234 </testExcludes>
235 </configuration>
236 <goals>
237 <goal>compile</goal>
238 <goal>testCompile</goal>
239 </goals>
240 </execution>
241 </executions>
242 </plugin>
243 <plugin>
244 <groupId>org.apache.maven.plugins</groupId>
245 <artifactId>maven-javadoc-plugin</artifactId>
246 <configuration>
247 <excludePackageNames>com.thoughtworks.xstream.core.util</excludePackageNames>
248 </configuration>
249 </plugin>
250 </plugins>
251 </build>
252 <reporting>
253 <plugins>
254 <plugin>
255 <groupId>org.apache.maven.plugins</groupId>
256 <artifactId>maven-javadoc-plugin</artifactId>
257 <version>${version.plugin.maven.javadoc}</version>
258 <configuration>
259 <excludePackageNames>com.thoughtworks.xstream.core.util</excludePackageNames>
260 <additionalparam>${javadoc.xdoclint}</additionalparam>
261 <detectJavaApiLink>false</detectJavaApiLink>
262 <source>${version.java.source}</source>
263 <links>
264 <link>${link.javadoc.javase}</link>
265 </links>
266 </configuration>
267 </plugin>
268 </plugins>
269 </reporting>
270 </profile>
271 <profile>
272 <id>jdk17</id>
273 <activation>
274 <jdk>1.7</jdk>
275 </activation>
276 <build>
277 <plugins>
278 <plugin>
279 <groupId>org.apache.maven.plugins</groupId>
280 <artifactId>maven-compiler-plugin</artifactId>
281 <configuration>
282 <compilerArgs>
283 <arg>-XDignore.symbol.file</arg>
284 </compilerArgs>
285 <excludes>
286 <exclude>**/Lambda**</exclude>
287 </excludes>
288 <testExcludes>
289 <exclude>**/Lambda**</exclude>
290 </testExcludes>
291 </configuration>
292 </plugin>
293 </plugins>
294 </build>
295 </profile>
296 <profile>
297 <id>jdk15-16</id>
298 <activation>
299 <jdk>[1.5,1.7)</jdk>
300 </activation>
301 <build>
302 <plugins>
303 <plugin>
304 <groupId>org.apache.maven.plugins</groupId>
305 <artifactId>maven-compiler-plugin</artifactId>
306 <configuration>
307 <compilerArgs>
308 <arg>-XDignore.symbol.file</arg>
309 </compilerArgs>
310 <excludes>
311 <exclude>**/Lambda**</exclude>
312 </excludes>
313 <testExcludes>
314 <exclude>**/Lambda**</exclude>
315 <exclude>**/extended/*17Test*</exclude>
316 </testExcludes>
317 </configuration>
318 </plugin>
319 </plugins>
320 </build>
321 </profile>
322 <profile>
323 <id>jdk15-ge</id>
324 <activation>
325 <jdk>[1.5,)</jdk>
326 </activation>
327 <build>
328 <plugins>
329 <plugin>
330 <groupId>org.apache.maven.plugins</groupId>
331 <artifactId>maven-jar-plugin</artifactId>
332 <executions>
333 <execution>
334 <id>default-jar</id>
335 <goals>
336 <goal>jar</goal>
337 </goals>
338 <configuration>
339 <archive combine.children="append">
340 <manifestFile>${project.build.directory}/OSGi/MANIFEST.MF</manifestFile>
341 </archive>
342 </configuration>
343 </execution>
344 </executions>
345 </plugin>
346 <plugin>
347 <groupId>org.apache.maven.plugins</groupId>
348 <artifactId>maven-source-plugin</artifactId>
349 </plugin>
350 <plugin>
351 <groupId>org.apache.felix</groupId>
352 <artifactId>maven-bundle-plugin</artifactId>
353 <configuration>
354 <instructions combine.children="append">
355 <Export-Package>!com.thoughtworks.xstream.core.util,com.thoughtworks.xstream.*;-noimport:=true</Export-Package>
356 </instructions>
357 </configuration>
358 </plugin>
359 </plugins>
360 </build>
361 </profile>
362 <profile>
363 <id>jdk14</id>
364 <activation>
365 <jdk>1.4</jdk>
366 </activation>
367 <build>
368 <plugins>
369 <plugin>
370 <groupId>org.apache.maven.plugins</groupId>
371 <artifactId>maven-compiler-plugin</artifactId>
372 <configuration>
373 <excludes>
374 <exclude>**/Lambda**</exclude>
375 <exclude>**/annotations/*</exclude>
376 <exclude>**/AnnotationMapper*</exclude>
377 <exclude>**/EnumMapper*</exclude>
378 <exclude>**/enums/*</exclude>
379 <exclude>**/basic/StringBuilder*</exclude>
380 <exclude>**/basic/UUID*</exclude>
381 <exclude>**/core/util/Types*</exclude>
382 <exclude>**/extended/*15*</exclude>
383 <exclude>**/io/xml/JDom2*</exclude>
384 </excludes>
385 <testExcludes>
386 <exclude>**/Lambda**</exclude>
387 <exclude>**/annotations/*</exclude>
388 <exclude>**/enums/*</exclude>
389 <exclude>**/extended/*17Test*</exclude>
390 <exclude>**/reflection/SunLimitedUnsafeReflectionProviderTest*</exclude>
391 <exclude>**/reflection/PureJavaReflectionProvider15Test*</exclude>
392 <exclude>**/io/xml/JDom2*Test*</exclude>
393 <exclude>**/acceptance/Basic15TypesTest*</exclude>
394 <exclude>**/acceptance/Concurrent15TypesTest*</exclude>
395 </testExcludes>
396 </configuration>
397 </plugin>
398 </plugins>
399 </build>
400 <dependencies>
401 <dependency>
402 <groupId>xml-apis</groupId>
403 <artifactId>xml-apis</artifactId>
404 </dependency>
405 <dependency>
406 <groupId>xerces</groupId>
407 <artifactId>xercesImpl</artifactId>
408 </dependency>
409 </dependencies>
410 <properties>
411 <version.org.codehaus.jettison>1.0.1</version.org.codehaus.jettison>
412 </properties>
413 </profile>
414 </profiles>
415
416 <reporting>
417 <plugins>
418 <plugin>
419 <groupId>org.apache.maven.plugins</groupId>
420 <artifactId>maven-surefire-report-plugin</artifactId>
421 <version>${version.plugin.maven.surefire}</version>
422 </plugin>
423 <plugin>
424 <groupId>org.codehaus.mojo</groupId>
425 <artifactId>cobertura-maven-plugin</artifactId>
426 <version>${version.plugin.mojo.cobertura}</version>
427 </plugin>
428 </plugins>
429 </reporting>
430
431 </project>
0 /*
1 * Copyright (C) 2007, 2008 XStream Committers.
2 * All rights reserved.
3 *
4 * The software in this package is published under the terms of the BSD
5 * style license a copy of which has been included with this distribution in
6 * the LICENSE.txt file.
7 *
8 * Created on 22. October 2007 by Joerg Schaible
9 */
10 package com.thoughtworks.xstream;
11
12 /**
13 * Exception thrown configuring an XStream instance.
14 *
15 * @author Joe Walnes
16 * @author J&ouml;rg Schaible
17 * @since 1.3
18 */
19 public class InitializationException extends XStream.InitializationException {
20 public InitializationException(String message, Throwable cause) {
21 super(message, cause);
22 }
23
24 public InitializationException(String message) {
25 super(message);
26 }
27 }
0 /*
1 * Copyright (C) 2004, 2006 Joe Walnes.
2 * Copyright (C) 2007, 2009 XStream Committers.
3 * All rights reserved.
4 *
5 * The software in this package is published under the terms of the BSD
6 * style license a copy of which has been included with this distribution in
7 * the LICENSE.txt file.
8 *
9 * Created on 16. March 2004 by Joe Walnes
10 */
11 package com.thoughtworks.xstream;
12
13 import com.thoughtworks.xstream.converters.ConverterLookup;
14 import com.thoughtworks.xstream.converters.DataHolder;
15 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
16 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
17 import com.thoughtworks.xstream.mapper.Mapper;
18
19 public interface MarshallingStrategy {
20
21 Object unmarshal(Object root, HierarchicalStreamReader reader, DataHolder dataHolder, ConverterLookup converterLookup, Mapper mapper);
22 void marshal(HierarchicalStreamWriter writer, Object obj, ConverterLookup converterLookup, Mapper mapper, DataHolder dataHolder);
23 }
0 /*
1 * Copyright (C) 2003, 2004, 2005, 2006 Joe Walnes.
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 XStream Committers.
3 * All rights reserved.
4 *
5 * The software in this package is published under the terms of the BSD
6 * style license a copy of which has been included with this distribution in
7 * the LICENSE.txt file.
8 *
9 * Created on 26. September 2003 by Joe Walnes
10 */
11 package com.thoughtworks.xstream;
12
13 import java.io.EOFException;
14 import java.io.File;
15 import java.io.IOException;
16 import java.io.InputStream;
17 import java.io.NotActiveException;
18 import java.io.ObjectInputStream;
19 import java.io.ObjectInputValidation;
20 import java.io.ObjectOutputStream;
21 import java.io.OutputStream;
22 import java.io.Reader;
23 import java.io.StringReader;
24 import java.io.StringWriter;
25 import java.io.Writer;
26 import java.lang.reflect.Constructor;
27 import java.lang.reflect.Field;
28 import java.lang.reflect.Method;
29 import java.math.BigDecimal;
30 import java.math.BigInteger;
31 import java.net.URI;
32 import java.net.URL;
33 import java.util.ArrayList;
34 import java.util.BitSet;
35 import java.util.Calendar;
36 import java.util.Collections;
37 import java.util.Date;
38 import java.util.GregorianCalendar;
39 import java.util.HashMap;
40 import java.util.HashSet;
41 import java.util.Hashtable;
42 import java.util.LinkedList;
43 import java.util.List;
44 import java.util.Locale;
45 import java.util.Map;
46 import java.util.Properties;
47 import java.util.Set;
48 import java.util.SortedSet;
49 import java.util.TreeMap;
50 import java.util.TreeSet;
51 import java.util.Vector;
52 import java.util.regex.Pattern;
53
54 import com.thoughtworks.xstream.converters.ConversionException;
55 import com.thoughtworks.xstream.converters.Converter;
56 import com.thoughtworks.xstream.converters.ConverterLookup;
57 import com.thoughtworks.xstream.converters.ConverterRegistry;
58 import com.thoughtworks.xstream.converters.DataHolder;
59 import com.thoughtworks.xstream.converters.SingleValueConverter;
60 import com.thoughtworks.xstream.converters.SingleValueConverterWrapper;
61 import com.thoughtworks.xstream.converters.basic.BigDecimalConverter;
62 import com.thoughtworks.xstream.converters.basic.BigIntegerConverter;
63 import com.thoughtworks.xstream.converters.basic.BooleanConverter;
64 import com.thoughtworks.xstream.converters.basic.ByteConverter;
65 import com.thoughtworks.xstream.converters.basic.CharConverter;
66 import com.thoughtworks.xstream.converters.basic.DateConverter;
67 import com.thoughtworks.xstream.converters.basic.DoubleConverter;
68 import com.thoughtworks.xstream.converters.basic.FloatConverter;
69 import com.thoughtworks.xstream.converters.basic.IntConverter;
70 import com.thoughtworks.xstream.converters.basic.LongConverter;
71 import com.thoughtworks.xstream.converters.basic.NullConverter;
72 import com.thoughtworks.xstream.converters.basic.ShortConverter;
73 import com.thoughtworks.xstream.converters.basic.StringBufferConverter;
74 import com.thoughtworks.xstream.converters.basic.StringConverter;
75 import com.thoughtworks.xstream.converters.basic.URIConverter;
76 import com.thoughtworks.xstream.converters.basic.URLConverter;
77 import com.thoughtworks.xstream.converters.collections.ArrayConverter;
78 import com.thoughtworks.xstream.converters.collections.BitSetConverter;
79 import com.thoughtworks.xstream.converters.collections.CharArrayConverter;
80 import com.thoughtworks.xstream.converters.collections.CollectionConverter;
81 import com.thoughtworks.xstream.converters.collections.MapConverter;
82 import com.thoughtworks.xstream.converters.collections.PropertiesConverter;
83 import com.thoughtworks.xstream.converters.collections.SingletonCollectionConverter;
84 import com.thoughtworks.xstream.converters.collections.SingletonMapConverter;
85 import com.thoughtworks.xstream.converters.collections.TreeMapConverter;
86 import com.thoughtworks.xstream.converters.collections.TreeSetConverter;
87 import com.thoughtworks.xstream.converters.extended.ColorConverter;
88 import com.thoughtworks.xstream.converters.extended.DynamicProxyConverter;
89 import com.thoughtworks.xstream.converters.extended.EncodedByteArrayConverter;
90 import com.thoughtworks.xstream.converters.extended.FileConverter;
91 import com.thoughtworks.xstream.converters.extended.FontConverter;
92 import com.thoughtworks.xstream.converters.extended.GregorianCalendarConverter;
93 import com.thoughtworks.xstream.converters.extended.JavaClassConverter;
94 import com.thoughtworks.xstream.converters.extended.JavaFieldConverter;
95 import com.thoughtworks.xstream.converters.extended.JavaMethodConverter;
96 import com.thoughtworks.xstream.converters.extended.LocaleConverter;
97 import com.thoughtworks.xstream.converters.extended.LookAndFeelConverter;
98 import com.thoughtworks.xstream.converters.extended.SqlDateConverter;
99 import com.thoughtworks.xstream.converters.extended.SqlTimeConverter;
100 import com.thoughtworks.xstream.converters.extended.SqlTimestampConverter;
101 import com.thoughtworks.xstream.converters.extended.TextAttributeConverter;
102 import com.thoughtworks.xstream.converters.reflection.ExternalizableConverter;
103 import com.thoughtworks.xstream.converters.reflection.ReflectionConverter;
104 import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
105 import com.thoughtworks.xstream.converters.reflection.SerializableConverter;
106 import com.thoughtworks.xstream.core.ClassLoaderReference;
107 import com.thoughtworks.xstream.core.DefaultConverterLookup;
108 import com.thoughtworks.xstream.core.JVM;
109 import com.thoughtworks.xstream.core.MapBackedDataHolder;
110 import com.thoughtworks.xstream.core.ReferenceByIdMarshallingStrategy;
111 import com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy;
112 import com.thoughtworks.xstream.core.TreeMarshallingStrategy;
113 import com.thoughtworks.xstream.core.util.CompositeClassLoader;
114 import com.thoughtworks.xstream.core.util.CustomObjectInputStream;
115 import com.thoughtworks.xstream.core.util.CustomObjectOutputStream;
116 import com.thoughtworks.xstream.core.util.SelfStreamingInstanceChecker;
117 import com.thoughtworks.xstream.io.HierarchicalStreamDriver;
118 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
119 import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
120 import com.thoughtworks.xstream.io.StatefulWriter;
121 import com.thoughtworks.xstream.io.xml.XppDriver;
122 import com.thoughtworks.xstream.mapper.AnnotationConfiguration;
123 import com.thoughtworks.xstream.mapper.ArrayMapper;
124 import com.thoughtworks.xstream.mapper.AttributeAliasingMapper;
125 import com.thoughtworks.xstream.mapper.AttributeMapper;
126 import com.thoughtworks.xstream.mapper.CachingMapper;
127 import com.thoughtworks.xstream.mapper.ClassAliasingMapper;
128 import com.thoughtworks.xstream.mapper.DefaultImplementationsMapper;
129 import com.thoughtworks.xstream.mapper.DefaultMapper;
130 import com.thoughtworks.xstream.mapper.DynamicProxyMapper;
131 import com.thoughtworks.xstream.mapper.FieldAliasingMapper;
132 import com.thoughtworks.xstream.mapper.ImmutableTypesMapper;
133 import com.thoughtworks.xstream.mapper.ImplicitCollectionMapper;
134 import com.thoughtworks.xstream.mapper.LocalConversionMapper;
135 import com.thoughtworks.xstream.mapper.Mapper;
136 import com.thoughtworks.xstream.mapper.MapperWrapper;
137 import com.thoughtworks.xstream.mapper.OuterClassMapper;
138 import com.thoughtworks.xstream.mapper.PackageAliasingMapper;
139 import com.thoughtworks.xstream.mapper.SecurityMapper;
140 import com.thoughtworks.xstream.mapper.SystemAttributeAliasingMapper;
141 import com.thoughtworks.xstream.mapper.XStream11XmlFriendlyMapper;
142 import com.thoughtworks.xstream.security.AnyTypePermission;
143 import com.thoughtworks.xstream.security.ExplicitTypePermission;
144 import com.thoughtworks.xstream.security.NoPermission;
145 import com.thoughtworks.xstream.security.NoTypePermission;
146 import com.thoughtworks.xstream.security.RegExpTypePermission;
147 import com.thoughtworks.xstream.security.TypeHierarchyPermission;
148 import com.thoughtworks.xstream.security.TypePermission;
149 import com.thoughtworks.xstream.security.WildcardTypePermission;
150
151
152 /**
153 * Simple facade to XStream library, a Java-XML serialization tool.
154 * <p>
155 * <hr>
156 * <b>Example</b><blockquote>
157 *
158 * <pre>
159 * XStream xstream = new XStream();
160 * String xml = xstream.toXML(myObject); // serialize to XML
161 * Object myObject2 = xstream.fromXML(xml); // deserialize from XML
162 * </pre>
163 *
164 * </blockquote>
165 * <hr>
166 *
167 * <h3>Aliasing classes</h3>
168 *
169 * <p>
170 * To create shorter XML, you can specify aliases for classes using the <code>alias()</code>
171 * method. For example, you can shorten all occurrences of element
172 * <code>&lt;com.blah.MyThing&gt;</code> to <code>&lt;my-thing&gt;</code> by registering an
173 * alias for the class.
174 * <p>
175 * <hr>
176 * <blockquote>
177 *
178 * <pre>
179 * xstream.alias(&quot;my-thing&quot;, MyThing.class);
180 * </pre>
181 *
182 * </blockquote>
183 * <hr>
184 *
185 * <h3>Converters</h3>
186 *
187 * <p>
188 * XStream contains a map of {@link com.thoughtworks.xstream.converters.Converter} instances, each
189 * of which acts as a strategy for converting a particular type of class to XML and back again. Out
190 * of the box, XStream contains converters for most basic types (String, Date, int, boolean, etc)
191 * and collections (Map, List, Set, Properties, etc). For other objects reflection is used to
192 * serialize each field recursively.
193 * </p>
194 *
195 * <p>
196 * Extra converters can be registered using the <code>registerConverter()</code> method. Some
197 * non-standard converters are supplied in the {@link com.thoughtworks.xstream.converters.extended}
198 * package and you can create your own by implementing the
199 * {@link com.thoughtworks.xstream.converters.Converter} interface.
200 * </p>
201 *
202 * <p>
203 * <hr>
204 * <b>Example</b><blockquote>
205 *
206 * <pre>
207 * xstream.registerConverter(new SqlTimestampConverter());
208 * xstream.registerConverter(new DynamicProxyConverter());
209 * </pre>
210 *
211 * </blockquote>
212 * <hr>
213 * <p>
214 * The converters can be registered with an explicit priority. By default they are registered with
215 * XStream.PRIORITY_NORMAL. Converters of same priority will be used in the reverse sequence
216 * they have been registered. The default converter, i.e. the converter which will be used if
217 * no other registered converter is suitable, can be registered with priority
218 * XStream.PRIORITY_VERY_LOW. XStream uses by default the
219 * {@link com.thoughtworks.xstream.converters.reflection.ReflectionConverter} as the fallback
220 * converter.
221 * </p>
222 *
223 * <p>
224 * <hr>
225 * <b>Example</b><blockquote>
226 *
227 * <pre>
228 * xstream.registerConverter(new CustomDefaultConverter(), XStream.PRIORITY_VERY_LOW);
229 * </pre>
230 *
231 * </blockquote>
232 * <hr>
233 *
234 * <h3>Object graphs</h3>
235 *
236 * <p>
237 * XStream has support for object graphs; a deserialized object graph will keep references intact,
238 * including circular references.
239 * </p>
240 *
241 * <p>
242 * XStream can signify references in XML using either relative/absolute XPath or IDs. The mode can be changed using
243 * <code>setMode()</code>:
244 * </p>
245 *
246 * <table border='1'>
247 * <caption></caption>
248 * <tr>
249 * <td><code>xstream.setMode(XStream.XPATH_RELATIVE_REFERENCES);</code></td>
250 * <td><i>(Default)</i> Uses XPath relative references to signify duplicate references. This produces XML
251 * with the least clutter.</td>
252 * </tr>
253 * <tr>
254 * <td><code>xstream.setMode(XStream.XPATH_ABSOLUTE_REFERENCES);</code></td>
255 * <td>Uses XPath absolute references to signify duplicate
256 * references. This produces XML with the least clutter.</td>
257 * </tr>
258 * <tr>
259 * <td><code>xstream.setMode(XStream.SINGLE_NODE_XPATH_RELATIVE_REFERENCES);</code></td>
260 * <td>Uses XPath relative references to signify duplicate references. The XPath expression ensures that
261 * a single node only is selected always.</td>
262 * </tr>
263 * <tr>
264 * <td><code>xstream.setMode(XStream.SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES);</code></td>
265 * <td>Uses XPath absolute references to signify duplicate references. The XPath expression ensures that
266 * a single node only is selected always.</td>
267 * </tr>
268 * <tr>
269 * <td><code>xstream.setMode(XStream.ID_REFERENCES);</code></td>
270 * <td>Uses ID references to signify duplicate references. In some scenarios, such as when using
271 * hand-written XML, this is easier to work with.</td>
272 * </tr>
273 * <tr>
274 * <td><code>xstream.setMode(XStream.NO_REFERENCES);</code></td>
275 * <td>This disables object graph support and treats the object structure like a tree. Duplicate
276 * references are treated as two separate objects and circular references cause an exception. This
277 * is slightly faster and uses less memory than the other two modes.</td>
278 * </tr>
279 * </table>
280 * <h3>Thread safety</h3>
281 * <p>
282 * The XStream instance is thread-safe. That is, once the XStream instance has been created and
283 * configured, it may be shared across multiple threads allowing objects to be
284 * serialized/deserialized concurrently. <em>Note, that this only applies if annotations are not
285 * auto-detected on-the-fly.</em>
286 * </p>
287 * <h3>Implicit collections</h3>
288 *
289 * <p>
290 * To avoid the need for special tags for collections, you can define implicit collections using one
291 * of the <code>addImplicitCollection</code> methods.
292 * </p>
293 *
294 * @author Joe Walnes
295 * @author J&ouml;rg Schaible
296 * @author Mauro Talevi
297 * @author Guilherme Silveira
298 */
299 public class XStream {
300
301 // CAUTION: The sequence of the fields is intentional for an optimal XML output of a
302 // self-serialization!
303 private ReflectionProvider reflectionProvider;
304 private HierarchicalStreamDriver hierarchicalStreamDriver;
305 private ClassLoaderReference classLoaderReference;
306 private MarshallingStrategy marshallingStrategy;
307 private ConverterLookup converterLookup;
308 private ConverterRegistry converterRegistry;
309 private Mapper mapper;
310
311 private PackageAliasingMapper packageAliasingMapper;
312 private ClassAliasingMapper classAliasingMapper;
313 private FieldAliasingMapper fieldAliasingMapper;
314 private AttributeAliasingMapper attributeAliasingMapper;
315 private SystemAttributeAliasingMapper systemAttributeAliasingMapper;
316 private AttributeMapper attributeMapper;
317 private DefaultImplementationsMapper defaultImplementationsMapper;
318 private ImmutableTypesMapper immutableTypesMapper;
319 private ImplicitCollectionMapper implicitCollectionMapper;
320 private LocalConversionMapper localConversionMapper;
321 private SecurityMapper securityMapper;
322 private AnnotationConfiguration annotationConfiguration;
323
324 public static final int NO_REFERENCES = 1001;
325 public static final int ID_REFERENCES = 1002;
326 public static final int XPATH_RELATIVE_REFERENCES = 1003;
327 public static final int XPATH_ABSOLUTE_REFERENCES = 1004;
328 public static final int SINGLE_NODE_XPATH_RELATIVE_REFERENCES = 1005;
329 public static final int SINGLE_NODE_XPATH_ABSOLUTE_REFERENCES = 1006;
330
331 public static final int PRIORITY_VERY_HIGH = 10000;
332 public static final int PRIORITY_NORMAL = 0;
333 public static final int PRIORITY_LOW = -10;
334 public static final int PRIORITY_VERY_LOW = -20;
335
336 private static final String ANNOTATION_MAPPER_TYPE = "com.thoughtworks.xstream.mapper.AnnotationMapper";
337 private static final Pattern IGNORE_ALL = Pattern.compile(".*");
338
339 /**
340 * Constructs a default XStream.
341 * <p>
342 * The instance will use the {@link XppDriver} as default and tries to determine the best
343 * match for the {@link ReflectionProvider} on its own.
344 * </p>
345 *
346 * @throws InitializationException in case of an initialization problem
347 */
348 public XStream() {
349 this(null, (Mapper)null, new XppDriver());
350 }
351
352 /**
353 * Constructs an XStream with a special {@link ReflectionProvider}.
354 * <p>
355 * The instance will use the {@link XppDriver} as default.
356 * </p>
357 *
358 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
359 * matching reflection provider
360 * @throws InitializationException in case of an initialization problem
361 */
362 public XStream(ReflectionProvider reflectionProvider) {
363 this(reflectionProvider, (Mapper)null, new XppDriver());
364 }
365
366 /**
367 * Constructs an XStream with a special {@link HierarchicalStreamDriver}.
368 * <p>
369 * The instance will tries to determine the best match for the {@link ReflectionProvider} on
370 * its own.
371 * </p>
372 *
373 * @param hierarchicalStreamDriver the driver instance
374 * @throws InitializationException in case of an initialization problem
375 */
376 public XStream(HierarchicalStreamDriver hierarchicalStreamDriver) {
377 this(null, (Mapper)null, hierarchicalStreamDriver);
378 }
379
380 /**
381 * Constructs an XStream with a special {@link HierarchicalStreamDriver} and
382 * {@link ReflectionProvider}.
383 *
384 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
385 * matching Provider
386 * @param hierarchicalStreamDriver the driver instance
387 * @throws InitializationException in case of an initialization problem
388 */
389 public XStream(
390 ReflectionProvider reflectionProvider, HierarchicalStreamDriver hierarchicalStreamDriver) {
391 this(reflectionProvider, (Mapper)null, hierarchicalStreamDriver);
392 }
393
394 /**
395 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
396 * {@link ReflectionProvider} and a prepared {@link Mapper} chain.
397 *
398 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
399 * matching Provider
400 * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default
401 * chain
402 * @param driver the driver instance
403 * @throws InitializationException in case of an initialization problem
404 * @deprecated As of 1.3, use
405 * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoader, Mapper)}
406 * instead
407 */
408 public XStream(
409 ReflectionProvider reflectionProvider, Mapper mapper, HierarchicalStreamDriver driver) {
410 this(reflectionProvider, driver, new CompositeClassLoader(), mapper);
411 }
412
413 /**
414 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
415 * {@link ReflectionProvider} and a {@link ClassLoaderReference}.
416 *
417 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
418 * matching Provider
419 * @param driver the driver instance
420 * @param classLoaderReference the reference to the {@link ClassLoader} to use
421 * @throws InitializationException in case of an initialization problem
422 * @since 1.4.5
423 */
424 public XStream(
425 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
426 ClassLoaderReference classLoaderReference) {
427 this(reflectionProvider, driver, classLoaderReference, null);
428 }
429
430 /**
431 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
432 * {@link ReflectionProvider} and the {@link ClassLoader} to use.
433 *
434 * @throws InitializationException in case of an initialization problem
435 * @since 1.3
436 * @deprecated As of 1.4.5 use
437 * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoaderReference)}
438 */
439 public XStream(
440 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
441 ClassLoader classLoader) {
442 this(reflectionProvider, driver, classLoader, null);
443 }
444
445 /**
446 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
447 * {@link ReflectionProvider}, a prepared {@link Mapper} chain and the {@link ClassLoader}
448 * to use.
449 *
450 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
451 * matching Provider
452 * @param driver the driver instance
453 * @param classLoader the {@link ClassLoader} to use
454 * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default
455 * chain
456 * @throws InitializationException in case of an initialization problem
457 * @since 1.3
458 * @deprecated As of 1.4.5 use
459 * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoaderReference, Mapper)}
460 */
461 public XStream(
462 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
463 ClassLoader classLoader, Mapper mapper) {
464 this(
465 reflectionProvider, driver, new ClassLoaderReference(classLoader), mapper, new DefaultConverterLookup());
466 }
467
468 /**
469 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
470 * {@link ReflectionProvider}, a prepared {@link Mapper} chain and the
471 * {@link ClassLoaderReference}.
472 * <p>
473 * The {@link ClassLoaderReference} should also be used for the {@link Mapper} chain.
474 * </p>
475 *
476 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
477 * matching Provider
478 * @param driver the driver instance
479 * @param classLoaderReference the reference to the {@link ClassLoader} to use
480 * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default
481 * chain
482 * @throws InitializationException in case of an initialization problem
483 * @since 1.4.5
484 */
485 public XStream(
486 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
487 ClassLoaderReference classLoaderReference, Mapper mapper) {
488 this(
489 reflectionProvider, driver, classLoaderReference, mapper, new DefaultConverterLookup());
490 }
491
492 private XStream(
493 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoader,
494 Mapper mapper, final DefaultConverterLookup defaultConverterLookup) {
495 this(reflectionProvider, driver, classLoader, mapper, new ConverterLookup() {
496 public Converter lookupConverterForType(Class type) {
497 return defaultConverterLookup.lookupConverterForType(type);
498 }
499 }, new ConverterRegistry() {
500 public void registerConverter(Converter converter, int priority) {
501 defaultConverterLookup.registerConverter(converter, priority);
502 }
503 });
504 }
505
506 /**
507 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
508 * {@link ReflectionProvider}, a prepared {@link Mapper} chain, the
509 * {@link ClassLoaderReference} and an own {@link ConverterLookup} and
510 * {@link ConverterRegistry}.
511 *
512 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
513 * matching Provider
514 * @param driver the driver instance
515 * @param classLoader the {@link ClassLoader} to use
516 * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default
517 * chain
518 * @param converterLookup the instance that is used to lookup the converters
519 * @param converterRegistry an instance to manage the converter instances
520 * @throws InitializationException in case of an initialization problem
521 * @since 1.3
522 * @deprecated As of 1.4.5 use
523 * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoaderReference, Mapper, ConverterLookup, ConverterRegistry)}
524 */
525 public XStream(
526 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
527 ClassLoader classLoader, Mapper mapper, ConverterLookup converterLookup,
528 ConverterRegistry converterRegistry) {
529 this(reflectionProvider, driver, new ClassLoaderReference(classLoader), mapper, converterLookup, converterRegistry);
530 }
531
532 /**
533 * Constructs an XStream with a special {@link HierarchicalStreamDriver},
534 * {@link ReflectionProvider}, a prepared {@link Mapper} chain, the
535 * {@link ClassLoaderReference} and an own {@link ConverterLookup} and
536 * {@link ConverterRegistry}.
537 * <p>
538 * The ClassLoaderReference should also be used for the Mapper chain. The ConverterLookup
539 * should access the ConverterRegistry if you intent to register {@link Converter} instances
540 * with XStream facade or you are using annotations.
541 * </p>
542 *
543 * @param reflectionProvider the reflection provider to use or <em>null</em> for best
544 * matching Provider
545 * @param driver the driver instance
546 * @param classLoaderReference the reference to the {@link ClassLoader} to use
547 * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default
548 * chain
549 * @param converterLookup the instance that is used to lookup the converters
550 * @param converterRegistry an instance to manage the converter instances or <em>null</em>
551 * to prevent any further registry (including annotations)
552 * @throws InitializationException in case of an initialization problem
553 * @since 1.4.5
554 */
555 public XStream(
556 ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver,
557 ClassLoaderReference classLoaderReference, Mapper mapper, ConverterLookup converterLookup,
558 ConverterRegistry converterRegistry) {
559 if (reflectionProvider == null) {
560 reflectionProvider = JVM.newReflectionProvider();
561 }
562 this.reflectionProvider = reflectionProvider;
563 this.hierarchicalStreamDriver = driver;
564 this.classLoaderReference = classLoaderReference;
565 this.converterLookup = converterLookup;
566 this.converterRegistry = converterRegistry;
567 this.mapper = mapper == null ? buildMapper() : mapper;
568
569 setupMappers();
570 setupSecurity();
571 setupAliases();
572 setupDefaultImplementations();
573 setupConverters();
574 setupImmutableTypes();
575 setMode(XPATH_RELATIVE_REFERENCES);
576 }
577
578 private Mapper buildMapper() {
579 Mapper mapper = new DefaultMapper(classLoaderReference);
580 if (useXStream11XmlFriendlyMapper()) {
581 mapper = new XStream11XmlFriendlyMapper(mapper);
582 }
583 mapper = new DynamicProxyMapper(mapper);
584 mapper = new PackageAliasingMapper(mapper);
585 mapper = new ClassAliasingMapper(mapper);
586 mapper = new FieldAliasingMapper(mapper);
587 mapper = new AttributeAliasingMapper(mapper);
588 mapper = new SystemAttributeAliasingMapper(mapper);
589 mapper = new ImplicitCollectionMapper(mapper);
590 mapper = new OuterClassMapper(mapper);
591 mapper = new ArrayMapper(mapper);
592 mapper = new DefaultImplementationsMapper(mapper);
593 mapper = new AttributeMapper(mapper, converterLookup, reflectionProvider);
594 if (JVM.is15()) {
595 mapper = buildMapperDynamically(
596 "com.thoughtworks.xstream.mapper.EnumMapper", new Class[]{Mapper.class},
597 new Object[]{mapper});
598 }
599 mapper = new LocalConversionMapper(mapper);
600 mapper = new ImmutableTypesMapper(mapper);
601 if (JVM.is18()) {
602 mapper = buildMapperDynamically("com.thoughtworks.xstream.mapper.LambdaMapper", new Class[]{Mapper.class},
603 new Object[]{mapper});
604 }
605 mapper = new SecurityMapper(mapper);
606 if (JVM.is15()) {
607 mapper = buildMapperDynamically(ANNOTATION_MAPPER_TYPE, new Class[]{
608 Mapper.class, ConverterRegistry.class, ConverterLookup.class,
609 ClassLoaderReference.class, ReflectionProvider.class}, new Object[]{
610 mapper, converterRegistry, converterLookup, classLoaderReference,
611 reflectionProvider});
612 }
613 mapper = wrapMapper((MapperWrapper)mapper);
614 mapper = new CachingMapper(mapper);
615 return mapper;
616 }
617
618 private Mapper buildMapperDynamically(String className, Class[] constructorParamTypes,
619 Object[] constructorParamValues) {
620 try {
621 Class type = Class.forName(className, false, classLoaderReference.getReference());
622 Constructor constructor = type.getConstructor(constructorParamTypes);
623 return (Mapper)constructor.newInstance(constructorParamValues);
624 } catch (Exception e) {
625 throw new com.thoughtworks.xstream.InitializationException(
626 "Could not instantiate mapper : " + className, e);
627 } catch (LinkageError e) {
628 throw new com.thoughtworks.xstream.InitializationException(
629 "Could not instantiate mapper : " + className, e);
630 }
631 }
632
633 protected MapperWrapper wrapMapper(MapperWrapper next) {
634 return next;
635 }
636
637 /**
638 * @deprecated As of 1.4.8
639 */
640 protected boolean useXStream11XmlFriendlyMapper() {
641 return false;
642 }
643
644 private void setupMappers() {
645 packageAliasingMapper = (PackageAliasingMapper)this.mapper
646 .lookupMapperOfType(PackageAliasingMapper.class);
647 classAliasingMapper = (ClassAliasingMapper)this.mapper
648 .lookupMapperOfType(ClassAliasingMapper.class);
649 fieldAliasingMapper = (FieldAliasingMapper)this.mapper
650 .lookupMapperOfType(FieldAliasingMapper.class);
651 attributeMapper = (AttributeMapper)this.mapper
652 .lookupMapperOfType(AttributeMapper.class);
653 attributeAliasingMapper = (AttributeAliasingMapper)this.mapper
654 .lookupMapperOfType(AttributeAliasingMapper.class);
655 systemAttributeAliasingMapper = (SystemAttributeAliasingMapper)this.mapper
656 .lookupMapperOfType(SystemAttributeAliasingMapper.class);
657 implicitCollectionMapper = (ImplicitCollectionMapper)this.mapper
658 .lookupMapperOfType(ImplicitCollectionMapper.class);
659 defaultImplementationsMapper = (DefaultImplementationsMapper)this.mapper
660 .lookupMapperOfType(DefaultImplementationsMapper.class);
661 immutableTypesMapper = (ImmutableTypesMapper)this.mapper
662 .lookupMapperOfType(ImmutableTypesMapper.class);
663 localConversionMapper = (LocalConversionMapper)this.mapper
664 .lookupMapperOfType(LocalConversionMapper.class);
665 securityMapper = (SecurityMapper)this.mapper
666 .lookupMapperOfType(SecurityMapper.class);
667 annotationConfiguration = (AnnotationConfiguration)this.mapper
668 .lookupMapperOfType(AnnotationConfiguration.class);
669 }
670
671 protected void setupSecurity() {
672 if (securityMapper == null) {
673 return;
674 }
675
676 addPermission(AnyTypePermission.ANY);
677 }
678
679 protected void setupAliases() {
680 if (classAliasingMapper == null) {
681 return;
682 }
683
684 alias("null", Mapper.Null.class);
685 alias("int", Integer.class);
686 alias("float", Float.class);
687 alias("double", Double.class);
688 alias("long", Long.class);
689 alias("short", Short.class);
690 alias("char", Character.class);
691 alias("byte", Byte.class);
692 alias("boolean", Boolean.class);
693 alias("number", Number.class);
694 alias("object", Object.class);
695 alias("big-int", BigInteger.class);
696 alias("big-decimal", BigDecimal.class);
697
698 alias("string-buffer", StringBuffer.class);
699 alias("string", String.class);
700 alias("java-class", Class.class);
701 alias("method", Method.class);
702 alias("constructor", Constructor.class);
703 alias("field", Field.class);
704 alias("date", Date.class);
705 alias("uri", URI.class);
706 alias("url", URL.class);
707 alias("bit-set", BitSet.class);
708
709 alias("map", Map.class);
710 alias("entry", Map.Entry.class);
711 alias("properties", Properties.class);
712 alias("list", List.class);
713 alias("set", Set.class);
714 alias("sorted-set", SortedSet.class);
715
716 alias("linked-list", LinkedList.class);
717 alias("vector", Vector.class);
718 alias("tree-map", TreeMap.class);
719 alias("tree-set", TreeSet.class);
720 alias("hashtable", Hashtable.class);
721
722 alias("empty-list", Collections.EMPTY_LIST.getClass());
723 alias("empty-map", Collections.EMPTY_MAP.getClass());
724 alias("empty-set", Collections.EMPTY_SET.getClass());
725 alias("singleton-list", Collections.singletonList(this).getClass());
726 alias("singleton-map", Collections.singletonMap(this, null).getClass());
727 alias("singleton-set", Collections.singleton(this).getClass());
728
729 if (JVM.isAWTAvailable()) {
730 // Instantiating these two classes starts the AWT system, which is undesirable.
731 // Calling loadClass ensures a reference to the class is found but they are not
732 // instantiated.
733 alias("awt-color", JVM.loadClassForName("java.awt.Color", false));
734 alias("awt-font", JVM.loadClassForName("java.awt.Font", false));
735 alias("awt-text-attribute", JVM.loadClassForName("java.awt.font.TextAttribute"));
736 }
737
738 if (JVM.isSQLAvailable()) {
739 alias("sql-timestamp", JVM.loadClassForName("java.sql.Timestamp"));
740 alias("sql-time", JVM.loadClassForName("java.sql.Time"));
741 alias("sql-date", JVM.loadClassForName("java.sql.Date"));
742 }
743
744 alias("file", File.class);
745 alias("locale", Locale.class);
746 alias("gregorian-calendar", Calendar.class);
747
748 if (JVM.is14()) {
749 aliasDynamically("auth-subject", "javax.security.auth.Subject");
750 alias("linked-hash-map", JVM.loadClassForName("java.util.LinkedHashMap"));
751 alias("linked-hash-set", JVM.loadClassForName("java.util.LinkedHashSet"));
752 alias("trace", JVM.loadClassForName("java.lang.StackTraceElement"));
753 alias("currency", JVM.loadClassForName("java.util.Currency"));
754 aliasType("charset", JVM.loadClassForName("java.nio.charset.Charset"));
755 }
756
757 if (JVM.is15()) {
758 aliasDynamically("duration", "javax.xml.datatype.Duration");
759 alias("concurrent-hash-map", JVM.loadClassForName("java.util.concurrent.ConcurrentHashMap"));
760 alias("enum-set", JVM.loadClassForName("java.util.EnumSet"));
761 alias("enum-map", JVM.loadClassForName("java.util.EnumMap"));
762 alias("string-builder", JVM.loadClassForName("java.lang.StringBuilder"));
763 alias("uuid", JVM.loadClassForName("java.util.UUID"));
764 }
765 if (JVM.loadClassForName("java.lang.invoke.SerializedLambda") != null) {
766 aliasDynamically("serialized-lambda", "java.lang.invoke.SerializedLambda");
767 }
768 }
769
770 private void aliasDynamically(String alias, String className) {
771 Class type = JVM.loadClassForName(className);
772 if (type != null) {
773 alias(alias, type);
774 }
775 }
776
777 protected void setupDefaultImplementations() {
778 if (defaultImplementationsMapper == null) {
779 return;
780 }
781 addDefaultImplementation(HashMap.class, Map.class);
782 addDefaultImplementation(ArrayList.class, List.class);
783 addDefaultImplementation(HashSet.class, Set.class);
784 addDefaultImplementation(TreeSet.class, SortedSet.class);
785 addDefaultImplementation(GregorianCalendar.class, Calendar.class);
786 }
787
788 protected void setupConverters() {
789 registerConverter(
790 new ReflectionConverter(mapper, reflectionProvider), PRIORITY_VERY_LOW);
791
792 registerConverter(
793 new SerializableConverter(mapper, reflectionProvider, classLoaderReference), PRIORITY_LOW);
794 registerConverter(new ExternalizableConverter(mapper, classLoaderReference), PRIORITY_LOW);
795
796 registerConverter(new NullConverter(), PRIORITY_VERY_HIGH);
797 registerConverter(new IntConverter(), PRIORITY_NORMAL);
798 registerConverter(new FloatConverter(), PRIORITY_NORMAL);
799 registerConverter(new DoubleConverter(), PRIORITY_NORMAL);
800 registerConverter(new LongConverter(), PRIORITY_NORMAL);
801 registerConverter(new ShortConverter(), PRIORITY_NORMAL);
802 registerConverter((Converter)new CharConverter(), PRIORITY_NORMAL);
803 registerConverter(new BooleanConverter(), PRIORITY_NORMAL);
804 registerConverter(new ByteConverter(), PRIORITY_NORMAL);
805
806 registerConverter(new StringConverter(), PRIORITY_NORMAL);
807 registerConverter(new StringBufferConverter(), PRIORITY_NORMAL);
808 registerConverter(new DateConverter(), PRIORITY_NORMAL);
809 registerConverter(new BitSetConverter(), PRIORITY_NORMAL);
810 registerConverter(new URIConverter(), PRIORITY_NORMAL);
811 registerConverter(new URLConverter(), PRIORITY_NORMAL);
812 registerConverter(new BigIntegerConverter(), PRIORITY_NORMAL);
813 registerConverter(new BigDecimalConverter(), PRIORITY_NORMAL);
814
815 registerConverter(new ArrayConverter(mapper), PRIORITY_NORMAL);
816 registerConverter(new CharArrayConverter(), PRIORITY_NORMAL);
817 registerConverter(new CollectionConverter(mapper), PRIORITY_NORMAL);
818 registerConverter(new MapConverter(mapper), PRIORITY_NORMAL);
819 registerConverter(new TreeMapConverter(mapper), PRIORITY_NORMAL);
820 registerConverter(new TreeSetConverter(mapper), PRIORITY_NORMAL);
821 registerConverter(new SingletonCollectionConverter(mapper), PRIORITY_NORMAL);
822 registerConverter(new SingletonMapConverter(mapper), PRIORITY_NORMAL);
823 registerConverter(new PropertiesConverter(), PRIORITY_NORMAL);
824 registerConverter((Converter)new EncodedByteArrayConverter(), PRIORITY_NORMAL);
825
826 registerConverter(new FileConverter(), PRIORITY_NORMAL);
827 if (JVM.isSQLAvailable()) {
828 registerConverter(new SqlTimestampConverter(), PRIORITY_NORMAL);
829 registerConverter(new SqlTimeConverter(), PRIORITY_NORMAL);
830 registerConverter(new SqlDateConverter(), PRIORITY_NORMAL);
831 }
832 registerConverter(
833 new DynamicProxyConverter(mapper, classLoaderReference), PRIORITY_NORMAL);
834 registerConverter(new JavaClassConverter(classLoaderReference), PRIORITY_NORMAL);
835 registerConverter(new JavaMethodConverter(classLoaderReference), PRIORITY_NORMAL);
836 registerConverter(new JavaFieldConverter(classLoaderReference), PRIORITY_NORMAL);
837 if (JVM.isAWTAvailable()) {
838 registerConverter(new FontConverter(mapper), PRIORITY_NORMAL);
839 registerConverter(new ColorConverter(), PRIORITY_NORMAL);
840 registerConverter(new TextAttributeConverter(), PRIORITY_NORMAL);
841 }
842 if (JVM.isSwingAvailable()) {
843 registerConverter(
844 new LookAndFeelConverter(mapper, reflectionProvider), PRIORITY_NORMAL);
845 }
846 registerConverter(new LocaleConverter(), PRIORITY_NORMAL);
847 registerConverter(new GregorianCalendarConverter(), PRIORITY_NORMAL);
848
849 if (JVM.is14()) {
850 // late bound converters - allows XStream to be compiled on earlier JDKs
851 registerConverterDynamically(
852 "com.thoughtworks.xstream.converters.extended.SubjectConverter",
853 PRIORITY_NORMAL, new Class[]{Mapper.class}, new Object[]{mapper});
854 registerConverterDynamically(
855 "com.thoughtworks.xstream.converters.extended.ThrowableConverter",
856 PRIORITY_NORMAL, new Class[]{ConverterLookup.class},
857 new Object[]{converterLookup});
858 registerConverterDynamically(
859 "com.thoughtworks.xstream.converters.extended.StackTraceElementConverter",
860 PRIORITY_NORMAL, null, null);
861 registerConverterDynamically(
862 "com.thoughtworks.xstream.converters.extended.CurrencyConverter",
863 PRIORITY_NORMAL, null, null);
864 registerConverterDynamically(
865 "com.thoughtworks.xstream.converters.extended.RegexPatternConverter",
866 PRIORITY_NORMAL, null, null);
867 registerConverterDynamically(
868 "com.thoughtworks.xstream.converters.extended.CharsetConverter",
869 PRIORITY_NORMAL, null, null);
870 }
871
872 if (JVM.is15()) {
873 // late bound converters - allows XStream to be compiled on earlier JDKs
874 if (JVM.loadClassForName("javax.xml.datatype.Duration") != null) {
875 registerConverterDynamically(
876 "com.thoughtworks.xstream.converters.extended.DurationConverter",
877 PRIORITY_NORMAL, null, null);
878 }
879 registerConverterDynamically(
880 "com.thoughtworks.xstream.converters.enums.EnumConverter", PRIORITY_NORMAL,
881 null, null);
882 registerConverterDynamically(
883 "com.thoughtworks.xstream.converters.enums.EnumSetConverter", PRIORITY_NORMAL,
884 new Class[]{Mapper.class}, new Object[]{mapper});
885 registerConverterDynamically(
886 "com.thoughtworks.xstream.converters.enums.EnumMapConverter", PRIORITY_NORMAL,
887 new Class[]{Mapper.class}, new Object[]{mapper});
888 registerConverterDynamically(
889 "com.thoughtworks.xstream.converters.basic.StringBuilderConverter",
890 PRIORITY_NORMAL, null, null);
891 registerConverterDynamically(
892 "com.thoughtworks.xstream.converters.basic.UUIDConverter", PRIORITY_NORMAL,
893 null, null);
894 }
895 if (JVM.is18()) {
896 registerConverterDynamically("com.thoughtworks.xstream.converters.reflection.LambdaConverter",
897 PRIORITY_NORMAL, new Class[]{Mapper.class, ReflectionProvider.class, ClassLoaderReference.class},
898 new Object[]{mapper, reflectionProvider, classLoaderReference});
899 }
900
901 registerConverter(
902 new SelfStreamingInstanceChecker(converterLookup, this), PRIORITY_NORMAL);
903 }
904
905 private void registerConverterDynamically(String className, int priority,
906 Class[] constructorParamTypes, Object[] constructorParamValues) {
907 try {
908 Class type = Class.forName(className, false, classLoaderReference.getReference());
909 Constructor constructor = type.getConstructor(constructorParamTypes);
910 Object instance = constructor.newInstance(constructorParamValues);
911 if (instance instanceof Converter) {
912 registerConverter((Converter)instance, priority);
913 } else if (instance instanceof SingleValueConverter) {
914 registerConverter((SingleValueConverter)instance, priority);
915 }
916 } catch (Exception e) {
917 throw new com.thoughtworks.xstream.InitializationException(
918 "Could not instantiate converter : " + className, e);
919 } catch (LinkageError e) {
920 throw new com.thoughtworks.xstream.InitializationException(
921 "Could not instantiate converter : " + className, e);
922 }
923 }
924
925 protected void setupImmutableTypes() {
926 if (immutableTypesMapper == null) {
927 return;
928 }
929
930 // primitives are always immutable
931 addImmutableType(boolean.class);
932 addImmutableType(Boolean.class);
933 addImmutableType(byte.class);
934 addImmutableType(Byte.class);
935 addImmutableType(char.class);
936 addImmutableType(Character.class);
937 addImmutableType(double.class);
938 addImmutableType(Double.class);
939 addImmutableType(float.class);
940 addImmutableType(Float.class);
941 addImmutableType(int.class);
942 addImmutableType(Integer.class);
943 addImmutableType(long.class);
944 addImmutableType(Long.class);
945 addImmutableType(short.class);
946 addImmutableType(Short.class);
947
948 // additional types
949 addImmutableType(Mapper.Null.class);
950 addImmutableType(BigDecimal.class);
951 addImmutableType(BigInteger.class);
952 addImmutableType(String.class);
953 addImmutableType(URI.class);
954 addImmutableType(URL.class);
955 addImmutableType(File.class);
956 addImmutableType(Class.class);
957
958 addImmutableType(Collections.EMPTY_LIST.getClass());
959 addImmutableType(Collections.EMPTY_SET.getClass());
960 addImmutableType(Collections.EMPTY_MAP.getClass());
961
962 if (JVM.isAWTAvailable()) {
963 addImmutableTypeDynamically("java.awt.font.TextAttribute");
964 }
965
966 if (JVM.is14()) {
967 // late bound types - allows XStream to be compiled on earlier JDKs
968 addImmutableTypeDynamically("java.nio.charset.Charset");
969 addImmutableTypeDynamically("java.util.Currency");
970 }
971 }
972
973 private void addImmutableTypeDynamically(String className) {
974 Class type = JVM.loadClassForName(className);
975 if (type != null) {
976 addImmutableType(type);
977 }
978 }
979
980 public void setMarshallingStrategy(MarshallingStrategy marshallingStrategy) {
981 this.marshallingStrategy = marshallingStrategy;
982 }
983
984 /**
985 * Serialize an object to a pretty-printed XML String.
986 *
987 * @throws XStreamException if the object cannot be serialized
988 */
989 public String toXML(Object obj) {
990 Writer writer = new StringWriter();
991 toXML(obj, writer);
992 return writer.toString();
993 }
994
995 /**
996 * Serialize an object to the given Writer as pretty-printed XML. The Writer will be flushed
997 * afterwards and in case of an exception.
998 *
999 * @throws XStreamException if the object cannot be serialized
1000 */
1001 public void toXML(Object obj, Writer out) {
1002 HierarchicalStreamWriter writer = hierarchicalStreamDriver.createWriter(out);
1003 try {
1004 marshal(obj, writer);
1005 } finally {
1006 writer.flush();
1007 }
1008 }
1009
1010 /**
1011 * Serialize an object to the given OutputStream as pretty-printed XML. The OutputStream
1012 * will be flushed afterwards and in case of an exception.
1013 *
1014 * @throws XStreamException if the object cannot be serialized
1015 */
1016 public void toXML(Object obj, OutputStream out) {
1017 HierarchicalStreamWriter writer = hierarchicalStreamDriver.createWriter(out);
1018 try {
1019 marshal(obj, writer);
1020 } finally {
1021 writer.flush();
1022 }
1023 }
1024
1025 /**
1026 * Serialize and object to a hierarchical data structure (such as XML).
1027 *
1028 * @throws XStreamException if the object cannot be serialized
1029 */
1030 public void marshal(Object obj, HierarchicalStreamWriter writer) {
1031 marshal(obj, writer, null);
1032 }
1033
1034 /**
1035 * Serialize and object to a hierarchical data structure (such as XML).
1036 *
1037 * @param dataHolder Extra data you can use to pass to your converters. Use this as you
1038 * want. If not present, XStream shall create one lazily as needed.
1039 * @throws XStreamException if the object cannot be serialized
1040 */
1041 public void marshal(Object obj, HierarchicalStreamWriter writer, DataHolder dataHolder) {
1042 marshallingStrategy.marshal(writer, obj, converterLookup, mapper, dataHolder);
1043 }
1044
1045 /**
1046 * Deserialize an object from an XML String.
1047 *
1048 * @throws XStreamException if the object cannot be deserialized
1049 */
1050 public Object fromXML(String xml) {
1051 return fromXML(new StringReader(xml));
1052 }
1053
1054 /**
1055 * Deserialize an object from an XML Reader.
1056 *
1057 * @throws XStreamException if the object cannot be deserialized
1058 */
1059 public Object fromXML(Reader reader) {
1060 return unmarshal(hierarchicalStreamDriver.createReader(reader), null);
1061 }
1062
1063 /**
1064 * Deserialize an object from an XML InputStream.
1065 *
1066 * @throws XStreamException if the object cannot be deserialized
1067 */
1068 public Object fromXML(InputStream input) {
1069 return unmarshal(hierarchicalStreamDriver.createReader(input), null);
1070 }
1071
1072 /**
1073 * Deserialize an object from a URL.
1074 *
1075 * Depending on the parser implementation, some might take the file path as SystemId to
1076 * resolve additional references.
1077 *
1078 * @throws XStreamException if the object cannot be deserialized
1079 * @since 1.4
1080 */
1081 public Object fromXML(URL url) {
1082 return fromXML(url, null);
1083 }
1084
1085 /**
1086 * Deserialize an object from a file.
1087 *
1088 * Depending on the parser implementation, some might take the file path as SystemId to
1089 * resolve additional references.
1090 *
1091 * @throws XStreamException if the object cannot be deserialized
1092 * @since 1.4
1093 */
1094 public Object fromXML(File file) {
1095 return fromXML(file, null);
1096 }
1097
1098 /**
1099 * Deserialize an object from an XML String, populating the fields of the given root object
1100 * instead of instantiating a new one. Note, that this is a special use case! With the
1101 * ReflectionConverter XStream will write directly into the raw memory area of the existing
1102 * object. Use with care!
1103 *
1104 * @throws XStreamException if the object cannot be deserialized
1105 */
1106 public Object fromXML(String xml, Object root) {
1107 return fromXML(new StringReader(xml), root);
1108 }
1109
1110 /**
1111 * Deserialize an object from an XML Reader, populating the fields of the given root object
1112 * instead of instantiating a new one. Note, that this is a special use case! With the
1113 * ReflectionConverter XStream will write directly into the raw memory area of the existing
1114 * object. Use with care!
1115 *
1116 * @throws XStreamException if the object cannot be deserialized
1117 */
1118 public Object fromXML(Reader xml, Object root) {
1119 return unmarshal(hierarchicalStreamDriver.createReader(xml), root);
1120 }
1121
1122 /**
1123 * Deserialize an object from a URL, populating the fields of the given root
1124 * object instead of instantiating a new one. Note, that this is a special use case! With
1125 * the ReflectionConverter XStream will write directly into the raw memory area of the
1126 * existing object. Use with care!
1127 *
1128 * Depending on the parser implementation, some might take the file path as SystemId to
1129 * resolve additional references.
1130 *
1131 * @throws XStreamException if the object cannot be deserialized
1132 * @since 1.4
1133 */
1134 public Object fromXML(URL url, Object root) {
1135 return unmarshal(hierarchicalStreamDriver.createReader(url), root);
1136 }
1137
1138 /**
1139 * Deserialize an object from a file, populating the fields of the given root
1140 * object instead of instantiating a new one. Note, that this is a special use case! With
1141 * the ReflectionConverter XStream will write directly into the raw memory area of the
1142 * existing object. Use with care!
1143 *
1144 * Depending on the parser implementation, some might take the file path as SystemId to
1145 * resolve additional references.
1146 *
1147 * @throws XStreamException if the object cannot be deserialized
1148 * @since 1.4
1149 */
1150 public Object fromXML(File file, Object root) {
1151 HierarchicalStreamReader reader = hierarchicalStreamDriver.createReader(file);
1152 try {
1153 return unmarshal(reader, root);
1154 } finally {
1155 reader.close();
1156 }
1157 }
1158
1159 /**
1160 * Deserialize an object from an XML InputStream, populating the fields of the given root
1161 * object instead of instantiating a new one. Note, that this is a special use case! With
1162 * the ReflectionConverter XStream will write directly into the raw memory area of the
1163 * existing object. Use with care!
1164 *
1165 * @throws XStreamException if the object cannot be deserialized
1166 */
1167 public Object fromXML(InputStream input, Object root) {
1168 return unmarshal(hierarchicalStreamDriver.createReader(input), root);
1169 }
1170
1171 /**
1172 * Deserialize an object from a hierarchical data structure (such as XML).
1173 *
1174 * @throws XStreamException if the object cannot be deserialized
1175 */
1176 public Object unmarshal(HierarchicalStreamReader reader) {
1177 return unmarshal(reader, null, null);
1178 }
1179
1180 /**
1181 * Deserialize an object from a hierarchical data structure (such as XML), populating the
1182 * fields of the given root object instead of instantiating a new one. Note, that this is a
1183 * special use case! With the ReflectionConverter XStream will write directly into the raw
1184 * memory area of the existing object. Use with care!
1185 *
1186 * @throws XStreamException if the object cannot be deserialized
1187 */
1188 public Object unmarshal(HierarchicalStreamReader reader, Object root) {
1189 return unmarshal(reader, root, null);
1190 }
1191
1192 /**
1193 * Deserialize an object from a hierarchical data structure (such as XML).
1194 *
1195 * @param root If present, the passed in object will have its fields populated, as opposed
1196 * to XStream creating a new instance. Note, that this is a special use case!
1197 * With the ReflectionConverter XStream will write directly into the raw memory
1198 * area of the existing object. Use with care!
1199 * @param dataHolder Extra data you can use to pass to your converters. Use this as you
1200 * want. If not present, XStream shall create one lazily as needed.
1201 * @throws XStreamException if the object cannot be deserialized
1202 */
1203 public Object unmarshal(HierarchicalStreamReader reader, Object root, DataHolder dataHolder) {
1204 try {
1205 return marshallingStrategy.unmarshal(
1206 root, reader, dataHolder, converterLookup, mapper);
1207
1208 } catch (ConversionException e) {
1209 Package pkg = getClass().getPackage();
1210 String version = pkg != null ? pkg.getImplementationVersion() : null;
1211 e.add("version", version != null ? version : "not available");
1212 throw e;
1213 }
1214 }
1215
1216 /**
1217 * Alias a Class to a shorter name to be used in XML elements.
1218 *
1219 * @param name Short name
1220 * @param type Type to be aliased
1221 * @throws InitializationException if no {@link ClassAliasingMapper} is available
1222 */
1223 public void alias(String name, Class type) {
1224 if (classAliasingMapper == null) {
1225 throw new com.thoughtworks.xstream.InitializationException("No "
1226 + ClassAliasingMapper.class.getName()
1227 + " available");
1228 }
1229 classAliasingMapper.addClassAlias(name, type);
1230 }
1231
1232 /**
1233 * Alias a type to a shorter name to be used in XML elements. Any class that is assignable
1234 * to this type will be aliased to the same name.
1235 *
1236 * @param name Short name
1237 * @param type Type to be aliased
1238 * @since 1.2
1239 * @throws InitializationException if no {@link ClassAliasingMapper} is available
1240 */
1241 public void aliasType(String name, Class type) {
1242 if (classAliasingMapper == null) {
1243 throw new com.thoughtworks.xstream.InitializationException("No "
1244 + ClassAliasingMapper.class.getName()
1245 + " available");
1246 }
1247 classAliasingMapper.addTypeAlias(name, type);
1248 }
1249
1250 /**
1251 * Alias a Class to a shorter name to be used in XML elements.
1252 *
1253 * @param name Short name
1254 * @param type Type to be aliased
1255 * @param defaultImplementation Default implementation of type to use if no other specified.
1256 * @throws InitializationException if no {@link DefaultImplementationsMapper} or no
1257 * {@link ClassAliasingMapper} is available
1258 */
1259 public void alias(String name, Class type, Class defaultImplementation) {
1260 alias(name, type);
1261 addDefaultImplementation(defaultImplementation, type);
1262 }
1263
1264 /**
1265 * Alias a package to a shorter name to be used in XML elements.
1266 *
1267 * @param name Short name
1268 * @param pkgName package to be aliased
1269 * @throws InitializationException if no {@link DefaultImplementationsMapper} or no
1270 * {@link PackageAliasingMapper} is available
1271 * @since 1.3.1
1272 */
1273 public void aliasPackage(String name, String pkgName) {
1274 if (packageAliasingMapper == null) {
1275 throw new com.thoughtworks.xstream.InitializationException("No "
1276 + PackageAliasingMapper.class.getName()
1277 + " available");
1278 }
1279 packageAliasingMapper.addPackageAlias(name, pkgName);
1280 }
1281
1282 /**
1283 * Create an alias for a field name.
1284 *
1285 * @param alias the alias itself
1286 * @param definedIn the type that declares the field
1287 * @param fieldName the name of the field
1288 * @throws InitializationException if no {@link FieldAliasingMapper} is available
1289 */
1290 public void aliasField(String alias, Class definedIn, String fieldName) {
1291 if (fieldAliasingMapper == null) {
1292 throw new com.thoughtworks.xstream.InitializationException("No "
1293 + FieldAliasingMapper.class.getName()
1294 + " available");
1295 }
1296 fieldAliasingMapper.addFieldAlias(alias, definedIn, fieldName);
1297 }
1298
1299 /**
1300 * Create an alias for an attribute
1301 *
1302 * @param alias the alias itself
1303 * @param attributeName the name of the attribute
1304 * @throws InitializationException if no {@link AttributeAliasingMapper} is available
1305 */
1306 public void aliasAttribute(String alias, String attributeName) {
1307 if (attributeAliasingMapper == null) {
1308 throw new com.thoughtworks.xstream.InitializationException("No "
1309 + AttributeAliasingMapper.class.getName()
1310 + " available");
1311 }
1312 attributeAliasingMapper.addAliasFor(attributeName, alias);
1313 }
1314
1315 /**
1316 * Create an alias for a system attribute. XStream will not write a system attribute if its
1317 * alias is set to <code>null</code>. However, this is not reversible, i.e. deserialization
1318 * of the result is likely to fail afterwards and will not produce an object equal to the
1319 * originally written one.
1320 *
1321 * @param alias the alias itself (may be <code>null</code>)
1322 * @param systemAttributeName the name of the system attribute
1323 * @throws InitializationException if no {@link SystemAttributeAliasingMapper} is available
1324 * @since 1.3.1
1325 */
1326 public void aliasSystemAttribute(String alias, String systemAttributeName) {
1327 if (systemAttributeAliasingMapper == null) {
1328 throw new com.thoughtworks.xstream.InitializationException("No "
1329 + SystemAttributeAliasingMapper.class.getName()
1330 + " available");
1331 }
1332 systemAttributeAliasingMapper.addAliasFor(systemAttributeName, alias);
1333 }
1334
1335 /**
1336 * Create an alias for an attribute.
1337 *
1338 * @param definedIn the type where the attribute is defined
1339 * @param attributeName the name of the attribute
1340 * @param alias the alias itself
1341 * @throws InitializationException if no {@link AttributeAliasingMapper} is available
1342 * @since 1.2.2
1343 */
1344 public void aliasAttribute(Class definedIn, String attributeName, String alias) {
1345 aliasField(alias, definedIn, attributeName);
1346 useAttributeFor(definedIn, attributeName);
1347 }
1348
1349 /**
1350 * Use an attribute for a field or a specific type.
1351 *
1352 * @param fieldName the name of the field
1353 * @param type the Class of the type to be rendered as XML attribute
1354 * @throws InitializationException if no {@link AttributeMapper} is available
1355 * @since 1.2
1356 */
1357 public void useAttributeFor(String fieldName, Class type) {
1358 if (attributeMapper == null) {
1359 throw new com.thoughtworks.xstream.InitializationException("No "
1360 + AttributeMapper.class.getName()
1361 + " available");
1362 }
1363 attributeMapper.addAttributeFor(fieldName, type);
1364 }
1365
1366 /**
1367 * Use an attribute for a field declared in a specific type.
1368 *
1369 * @param fieldName the name of the field
1370 * @param definedIn the Class containing such field
1371 * @throws InitializationException if no {@link AttributeMapper} is available
1372 * @since 1.2.2
1373 */
1374 public void useAttributeFor(Class definedIn, String fieldName) {
1375 if (attributeMapper == null) {
1376 throw new com.thoughtworks.xstream.InitializationException("No "
1377 + AttributeMapper.class.getName()
1378 + " available");
1379 }
1380 attributeMapper.addAttributeFor(definedIn, fieldName);
1381 }
1382
1383 /**
1384 * Use an attribute for an arbitrary type.
1385 *
1386 * @param type the Class of the type to be rendered as XML attribute
1387 * @throws InitializationException if no {@link AttributeMapper} is available
1388 * @since 1.2
1389 */
1390 public void useAttributeFor(Class type) {
1391 if (attributeMapper == null) {
1392 throw new com.thoughtworks.xstream.InitializationException("No "
1393 + AttributeMapper.class.getName()
1394 + " available");
1395 }
1396 attributeMapper.addAttributeFor(type);
1397 }
1398
1399 /**
1400 * Associate a default implementation of a class with an object. Whenever XStream encounters
1401 * an instance of this type, it will use the default implementation instead. For example,
1402 * java.util.ArrayList is the default implementation of java.util.List.
1403 *
1404 * @param defaultImplementation
1405 * @param ofType
1406 * @throws InitializationException if no {@link DefaultImplementationsMapper} is available
1407 */
1408 public void addDefaultImplementation(Class defaultImplementation, Class ofType) {
1409 if (defaultImplementationsMapper == null) {
1410 throw new com.thoughtworks.xstream.InitializationException("No "
1411 + DefaultImplementationsMapper.class.getName()
1412 + " available");
1413 }
1414 defaultImplementationsMapper.addDefaultImplementation(defaultImplementation, ofType);
1415 }
1416
1417 /**
1418 * Add immutable types. The value of the instances of these types will always be written
1419 * into the stream even if they appear multiple times.
1420 *
1421 * @throws InitializationException if no {@link ImmutableTypesMapper} is available
1422 */
1423 public void addImmutableType(Class type) {
1424 if (immutableTypesMapper == null) {
1425 throw new com.thoughtworks.xstream.InitializationException("No "
1426 + ImmutableTypesMapper.class.getName()
1427 + " available");
1428 }
1429 immutableTypesMapper.addImmutableType(type);
1430 }
1431
1432 public void registerConverter(Converter converter) {
1433 registerConverter(converter, PRIORITY_NORMAL);
1434 }
1435
1436 public void registerConverter(Converter converter, int priority) {
1437 if (converterRegistry != null) {
1438 converterRegistry.registerConverter(converter, priority);
1439 }
1440 }
1441
1442 public void registerConverter(SingleValueConverter converter) {
1443 registerConverter(converter, PRIORITY_NORMAL);
1444 }
1445
1446 public void registerConverter(SingleValueConverter converter, int priority) {
1447 if (converterRegistry != null) {
1448 converterRegistry.registerConverter(
1449 new SingleValueConverterWrapper(converter), priority);
1450 }
1451 }
1452
1453 /**
1454 * Register a local {@link Converter} for a field.
1455 *
1456 * @param definedIn the class type the field is defined in
1457 * @param fieldName the field name
1458 * @param converter the converter to use
1459 * @since 1.3
1460 */
1461 public void registerLocalConverter(Class definedIn, String fieldName, Converter converter) {
1462 if (localConversionMapper == null) {
1463 throw new com.thoughtworks.xstream.InitializationException("No "
1464 + LocalConversionMapper.class.getName()
1465 + " available");
1466 }
1467 localConversionMapper.registerLocalConverter(definedIn, fieldName, converter);
1468 }
1469
1470 /**
1471 * Register a local {@link SingleValueConverter} for a field.
1472 *
1473 * @param definedIn the class type the field is defined in
1474 * @param fieldName the field name
1475 * @param converter the converter to use
1476 * @since 1.3
1477 */
1478 public void registerLocalConverter(Class definedIn, String fieldName,
1479 SingleValueConverter converter) {
1480 registerLocalConverter(
1481 definedIn, fieldName, (Converter)new SingleValueConverterWrapper(converter));
1482 }
1483
1484 /**
1485 * Retrieve the {@link Mapper}. This is by default a chain of {@link MapperWrapper
1486 * MapperWrappers}.
1487 *
1488 * @return the mapper
1489 * @since 1.2
1490 */
1491 public Mapper getMapper() {
1492 return mapper;
1493 }
1494
1495 /**
1496 * Retrieve the {@link ReflectionProvider} in use.
1497 *
1498 * @return the mapper
1499 * @since 1.2.1
1500 */
1501 public ReflectionProvider getReflectionProvider() {
1502 return reflectionProvider;
1503 }
1504
1505 public ConverterLookup getConverterLookup() {
1506 return converterLookup;
1507 }
1508
1509 /**
1510 * Change mode for dealing with duplicate references. Valid values are
1511 * <code>XPATH_ABSOLUTE_REFERENCES</code>, <code>XPATH_RELATIVE_REFERENCES</code>,
1512 * <code>XStream.ID_REFERENCES</code> and <code>XStream.NO_REFERENCES</code>.
1513 *
1514 * @throws IllegalArgumentException if the mode is not one of the declared types
1515 * @see #XPATH_ABSOLUTE_REFERENCES
1516 * @see #XPATH_RELATIVE_REFERENCES
1517 * @see #ID_REFERENCES
1518 * @see #NO_REFERENCES
1519 */
1520 public void setMode(int mode) {
1521 switch (mode) {