stoicflame / ofx4j

Apache License 2.0
75 stars 50 forks source link

Write lists annotated by @Element to multiple tags, rather than list form #57

Closed ekennedy247 closed 3 years ago

ekennedy247 commented 3 years ago

Right now, if you try to unmarshall a list of elements (such as List<String>, it will be interpreted as [ELEMENT1, ELEMENT2]. This seems to be against how the spec generally works. Examples are distribution codes for 1099R where it's a basic type, with an unbounded number of elements.

Updated some tests, so feel pretty comfortable with the change, but if we want to talk more through it I'm happy to have that conversation!

Pretty much it can be summed up as I think that:

@Element(name = "TESTELEMENT")
List<String> elements;

Should be represented as:

<TESTELEMENT>test</TESTELEMENT><TESTELEMENT>test 2</TESTELEMENT>

vs

<TESTELEMENT>[test, test 2]</TESTELEMENT>

Results :

Tests run: 29, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.720 s
[INFO] Finished at: 2021-01-12T14:51:54-05:00
[INFO] ------------------------------------------------------------------------
stoicflame commented 3 years ago

Version 1.29