hashmap - JAXB unmarshal map with object that contains yet another map -


I have successfully used JAXB to make some XML file uncompressed but I have another case Is more complex. Basically my XML file looks like this: & lt; BCLCurrenciesInflation & gt; & Lt; CurrenciesInflation & gt; & Lt; Currency & gt; & Lt; CurencyName & gt; Yen & lt; / CurencyName & gt; & Lt; COUNTRYNAME & gt; Japan & lt; / COUNTRYNAME & gt; & Lt; IssuingDate & gt; 1900/01/01 & lt; / IssuingDate & gt; & Lt; ExpirationDate & gt; & Lt; / ExpirationDate & gt; & Lt; Inflation & gt; & Lt; Years & gt; 1900 & lt; / Year & gt; & Lt; Percentage & gt; 16 & lt; / Percent & gt; & Lt; / Inflation & gt; & Lt; Inflation & gt; & Lt; Years & gt; 1901 & lt; / Year & gt; & Lt; Percentage & gt; 17 & lt; / Percent & gt; & Lt; / Inflation & gt; & Lt; / Currency & gt; & Lt; Currency & gt; & Lt; CurencyName & gt; Dollar & lt; / CurencyName & gt; & Lt; COUNTRYNAME & gt; United States & lt; / COUNTRYNAME & gt; & Lt; IssuingDate & gt; 1900/01/01 & lt; / IssuingDate & gt; & Lt; ExpirationDate & gt; & Lt; / ExpirationDate & gt; & Lt; Inflation & gt; & Lt; Years & gt; 1902 & lt; / Year & gt; & Lt; Percentage & gt; 18 & lt; / Percent & gt; & Lt; / Inflation & gt; & Lt; Inflation & gt; & Lt; Years & gt; 1903 & lt; / Year & gt; & Lt; Percentage & gt; 19 & lt; / Percent & gt; & Lt; / Inflation & gt; & Lt; / Currency & gt; & Lt; / CurrenciesInflation & gt;

It's basically a hashmap and BCLCurrency looks like this:

  public class BCLCurrency {@XmlElement (name = "currencyName") the name of the public string; @ XMLElement (name = "countryname") public string country; @ XMLElement (name = "issuing") date of issue of public string; @ XmlElement (name = "expiration date") public string end date; @ XMLElement (name = "inflation") public map & lt; String, float & gt; InflationMap; }   

I was thinking about having two adapters, the second would be called by the first adapter, but I did not feel comfortable with that solution.

How to pull it off?

PD: Funny story I can not say hello at the beginning of the post, the system keeps pressing it!

Post text "itemprop =" text ">

You can create / use a generic adapter for the map instead of & lt; K, V & gt; instead of creating two adapters. / P>

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -