From ce1749fe837ce8077016ae28273f914b2c90f1dc Mon Sep 17 00:00:00 2001 From: akulikov Date: Thu, 1 Sep 2022 18:32:36 +0300 Subject: [PATCH] reports-service: simple prototype fix --- clearing-parent/pom.xml | 1 + .../xml_test/ChildElementForWrite.java | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/clearing-parent/pom.xml b/clearing-parent/pom.xml index 130d7fa45..717490f8d 100644 --- a/clearing-parent/pom.xml +++ b/clearing-parent/pom.xml @@ -26,6 +26,7 @@ securities-service utility-service company-service + reports-service diff --git a/clearing-parent/reports-service/src/main/java/ru/spcex/clearing/reports_service/xml_test/ChildElementForWrite.java b/clearing-parent/reports-service/src/main/java/ru/spcex/clearing/reports_service/xml_test/ChildElementForWrite.java index 99d3e7cb5..ba1db7e10 100644 --- a/clearing-parent/reports-service/src/main/java/ru/spcex/clearing/reports_service/xml_test/ChildElementForWrite.java +++ b/clearing-parent/reports-service/src/main/java/ru/spcex/clearing/reports_service/xml_test/ChildElementForWrite.java @@ -6,6 +6,9 @@ import com.thoughtworks.xstream.annotations.XStreamAsAttribute; import com.thoughtworks.xstream.annotations.XStreamConverter; import com.thoughtworks.xstream.annotations.XStreamOmitField; import com.thoughtworks.xstream.converters.basic.BooleanConverter; +import com.thoughtworks.xstream.converters.basic.DateConverter; + +import java.util.Date; // without aliases public class ChildElementForWrite { @@ -15,15 +18,18 @@ public class ChildElementForWrite { @XStreamAsAttribute private Integer testAttributeInt = Integer.MIN_VALUE; + // при использовании настраевомого встроенного конвертора, ему необходимо передать параметры в конструктор + // делается это посредством параметров strings, booleans, nulls. + // т.е. такая запись эквивалентна: + // new DateConverter("MM-yyyy-dd", null) + @XStreamConverter(value = DateConverter.class, strings = {"MM-yyyy-dd"}, nulls = {String[].class}) + private Date testDate = new Date(); + @XStreamAsAttribute @XStreamAlias("isBoolean") - @XStreamConverter(value = BooleanConverter.class, booleans = {false}, strings = {"yes", "no"}) + @XStreamConverter(value = BooleanConverter.class, booleans = {true}, strings = {"yes", "no"}) private Boolean testYesAttributeBool = Boolean.TRUE; -// @XStreamAlias("booleanField") -// @XStreamConverter(value = BooleanConverter.class, booleans = {true, false}, strings = {"yes", "no"}) -// private Boolean testNoFieldBool = Boolean.FALSE; - private Integer testChildInt = Integer.MAX_VALUE; @XStreamOmitField