From 373016ccdb6169cc0a118a519a905b09969ad9dc Mon Sep 17 00:00:00 2001 From: joehni Date: Wed, 14 Dec 2022 00:28:53 +0100 Subject: [PATCH] Add converter for Optional. Closes #293 and #294. --- xstream-distribution/src/content/changes.html | 4 + .../src/content/converters.html | 11 +++ xstream-distribution/src/content/team.html | 3 +- .../com/thoughtworks/xstream/XStream.java | 5 ++ .../extended/OptionalConverter.java | 73 +++++++++++++++++++ .../acceptance/ExtendedTypesTest.java | 48 +++++++++++- 6 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 xstream/src/java/com/thoughtworks/xstream/converters/extended/OptionalConverter.java diff --git a/xstream-distribution/src/content/changes.html b/xstream-distribution/src/content/changes.html index c81150490..acf3f3450 100644 --- a/xstream-distribution/src/content/changes.html +++ b/xstream-distribution/src/content/changes.html @@ -111,6 +111,7 @@

Major changes

Stream compatibility

@@ -118,6 +119,8 @@

Stream compatibility

API changes

@@ -127,6 +130,7 @@

API changes

  • Added c.t.x.converters.extended.AtomicIntegerConverter.
  • Added c.t.x.converters.extended.AtomicLongConverter.
  • Added c.t.x.converters.extended.AtomicReferenceConverter.
  • +
  • Added c.t.x.converters.extended.OptionalConverter.
  • 1.4.19

    diff --git a/xstream-distribution/src/content/converters.html b/xstream-distribution/src/content/converters.html index 08829b806..a48f58323 100644 --- a/xstream-distribution/src/content/converters.html +++ b/xstream-distribution/src/content/converters.html @@ -425,6 +425,17 @@ Available with Java 1.5 or greater. normal + + OptionalConverter + java.util.Optional + + <optional>
    +   <value  class="string">test</value>
    + </optional> + + Available with Java 1.8 or greater. + normal + EnumMapConverter java.util.EnumMap diff --git a/xstream-distribution/src/content/team.html b/xstream-distribution/src/content/team.html index 32d9116ea..d1cefbce8 100644 --- a/xstream-distribution/src/content/team.html +++ b/xstream-distribution/src/content/team.html @@ -1,7 +1,7 @@