{"id":9483,"date":"2013-03-07T13:00:29","date_gmt":"2013-03-07T11:00:29","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=9483"},"modified":"2013-03-07T05:02:16","modified_gmt":"2013-03-07T03:02:16","slug":"jaxb-and-java-util-map","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html","title":{"rendered":"JAXB and java.util.Map"},"content":{"rendered":"<p>Is it ironic that it can be difficult to map the <i>java.util.Map <\/i>class in <a href=\"http:\/\/jcp.org\/en\/jsr\/detail?id=222\" target=\"_blank\">JAXB (JSR-222)<\/a>? In this post I will cover some items that will make it much easier.<\/p>\n<h2>Java Model<\/h2>\n<p>Below is the Java model that we will use for this example.<\/p>\n<h4>Customer<\/h4>\n<p>The <i>Customer<\/i> class has a property of type <i>Map <\/i>. I chose this <i>Map<\/i> specifically since the key is a domain object and the value is a domain object.<\/p>\n<pre class=\" brush:java\">package blog.map;\r\n\r\nimport java.util.*;\r\nimport javax.xml.bind.annotation.*;\r\n\r\n@XmlRootElement\r\npublic class Customer {\r\n\r\n    private Map&lt;String, Address&gt; addressMap = new HashMap&lt;String, Address&gt;();\r\n\r\n    public Map&lt;String, Address&gt; getAddressMap() {\r\n        return addressMap;\r\n    }\r\n\r\n    public void setAddressMap(Map&lt;String, Address&gt; addressMap) {\r\n        this.addressMap = addressMap;\r\n    }\r\n\r\n}<\/pre>\n<h4>Address<\/h4>\n<p>The Address class is just a typical POJO.<\/p>\n<pre class=\" brush:java\">package blog.map;\r\n\r\npublic class Address {\r\n\r\n    private String street;\r\n\r\n    public String getStreet() {\r\n        return street;\r\n    }\r\n\r\n    public void setStreet(String street) {\r\n        this.street = street;\r\n    }\r\n\r\n}<\/pre>\n<h2>Demo Code <\/h2>\n<p>In the demo code below we will create an instance of <i>Customer<\/i> and populate its <i>Map<\/i> property. Then we will marshal it to XML.<\/p>\n<pre class=\" brush:java\">package blog.map;\r\n\r\nimport javax.xml.bind.*;\r\n\r\npublic class Demo {\r\n\r\n    public static void main(String[] args) throws Exception {\r\n        JAXBContext jc = JAXBContext.newInstance(Customer.class);\r\n\r\n        Address billingAddress = new Address();\r\n        billingAddress.setStreet('1 A Street');\r\n\r\n        Address shippingAddress = new Address();\r\n        shippingAddress.setStreet('2 B Road');\r\n\r\n        Customer customer = new Customer();\r\n        customer.getAddressMap().put('billing', billingAddress);\r\n        customer.getAddressMap().put('shipping', shippingAddress);\r\n\r\n        Marshaller marshaller = jc.createMarshaller();\r\n        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);\r\n        marshaller.marshal(customer, System.out);\r\n    }\r\n\r\n}<\/pre>\n<h2>Use Case #1 &#8211; Default Representation<\/h2>\n<p>Below is a sample of XML corresponding to our domain model. We see that each item in the <i>Map\u00a0 <\/i>has <i>key\u00a0 <\/i>and <i>value<\/i> elements wrapped in an <i>entry<\/i> element.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;customer&gt;\r\n    &lt;addressMap&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;shipping&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;street&gt;2 B Road&lt;\/street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;billing&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;street&gt;1 A Street&lt;\/street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n    &lt;\/addressMap&gt;\r\n&lt;\/customer&gt;<\/pre>\n<h2>Use Case #2 &#8211; Rename the Element <\/h2>\n<p>The JAXB reference implementation uses the <i>@XmlElementWrapper<\/i> annotation to rename the element corresponding to a <i>Map<\/i> property (we&#8217;ve added this support to MOXy in EclipseLink 2.4.2 and 2.5.0). In previous versions of MOXy the <i>@XmlElement <\/i>annotation should be used.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h4>Customer <\/h4>\n<p>We will use the <i>@XmlElementWrapper<\/i> annotation to rename the element corresponding to the <i>addressMap<\/i> property to be <i>addresses<\/i>.<\/p>\n<pre class=\" brush:java\">package blog.map;\r\n\r\nimport java.util.*;\r\nimport javax.xml.bind.annotation.*;\r\n\r\n@XmlRootElement\r\npublic class Customer {\r\n\r\n    private Map&lt;String, Address&gt; addressMap = new HashMap&lt;String, Address&gt;();\r\n\r\n    @XmlElementWrapper(name='addresses')\r\n    public Map&lt;String, Address&gt; getAddressMap() {\r\n        return addressMap;\r\n    }\r\n\r\n    public void setAddressMap(Map&lt;String, Address&gt; addressMap) {\r\n        this.addressMap = addressMap;\r\n    }\r\n\r\n}<\/pre>\n<h4>Output<\/h4>\n<p>Now we see that the <i>addressMap<\/i> element has been renamed to <i>addresses<\/i>.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;customer&gt;\r\n    &lt;addresses&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;shipping&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;street&gt;2 B Road&lt;\/street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;billing&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;street&gt;1 A Street&lt;\/street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n    &lt;\/addresses&gt;\r\n&lt;\/customer&gt;<\/pre>\n<h2>Use Case #3 &#8211; Add Namespace Qualification<\/h2>\n<p>In this use case we will examine the impact of applying namespace qualification to a class that has a property of type <i>java.util.Map<\/i> . There was a MOXy bug related to the namespace qualification of Map properties that has been fixed in EclipseLink 2.4.2 and 2.5.0 (see: <a href=\"http:\/\/bugs.eclipse.org\/399297\">http:\/\/bugs.eclipse.org\/399297<\/a>).<\/p>\n<h4>package-info<\/h4>\n<p>We will use the package level <i>@XmlSchema <\/i>annotation to specify that all fields\/properties belonging to classes in this package should be qualified with the <i> http:\/\/www.example.com<\/i> namespace (see: <a href=\"http:\/\/blog.bdoughan.com\/2010\/08\/jaxb-namespaces.html\">JAXB &amp; Namespaces<\/a>).<\/p>\n<pre class=\" brush:java\">@XmlSchema(\r\n    namespace='http:\/\/www.example.com',\r\n    elementFormDefault=XmlNsForm.QUALIFIED)\r\npackage blog.map;\r\n\r\nimport javax.xml.bind.annotation.*;<\/pre>\n<h4>Output <\/h4>\n<p>We see that the elements corresponding to the <i>Customer<\/i> and <i>Address <\/i>classes are namespace qualified, but the elements corresponding to the <i>Map<\/i> class are not. This is because the <i>Map<\/i> class is from the <i>java.util <\/i>package and therefore the information we specified on the package level <i>@XmlSchema<\/i> annotation does not apply.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;ns2:customer xmlns:ns2='http:\/\/www.example.com'&gt;\r\n    &lt;ns2:addresses&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;shipping&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;ns2:street&gt;2 B Road&lt;\/ns2:street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;billing&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;ns2:street&gt;1 A Street&lt;\/ns2:street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n    &lt;\/ns2:addresses&gt;\r\n&lt;\/ns2:customer&gt;<\/pre>\n<h2>Use Case #4 &#8211; Fix Namespace Qualification with an XmlAdapter <\/h2>\n<p>We can use an <i>XmlAdapter<\/i> to adjust the namespace qualification from the previous use case.<\/p>\n<h4>XmlAdapter (MapAdapter)<\/h4>\n<p>The <i>XmlAdapter<\/i> mechanism allows you to convert a class to another for the purpose of affecting the mapping (see: <a href=\"http:\/\/blog.bdoughan.com\/2010\/07\/xmladapter-jaxbs-secret-weapon.html\">XmlAdapter &#8211; JAXB&#8217;s Secret Weapon<\/a>). To get the appropriate namespace qualification we will use an <i>XmlAdapter<\/i> to convert the <i>Map<\/i> to objects in the package for our domain model.<\/p>\n<pre class=\" brush:java\">package blog.map;\r\n\r\nimport java.util.*;\r\nimport javax.xml.bind.annotation.adapters.XmlAdapter;\r\n\r\npublic class MapAdapter extends XmlAdapter&lt;MapAdapter.AdaptedMap, Map&lt;String, Address&gt;&gt; {\r\n\r\n    public static class AdaptedMap {\r\n\r\n        public List&lt;Entry&gt; entry = new ArrayList&lt;Entry&gt;();\r\n\r\n    }\r\n\r\n    public static class Entry {\r\n\r\n        public String key;\r\n\r\n        public Address value;\r\n\r\n    }\r\n\r\n    @Override\r\n    public Map&lt;String, Address&gt; unmarshal(AdaptedMap adaptedMap) throws Exception {\r\n        Map&lt;String, Address&gt; map = new HashMap&lt;String, Address&gt;();\r\n        for(Entry entry : adaptedMap.entry) {\r\n            map.put(entry.key, entry.value);\r\n        }\r\n        return map;\r\n    }\r\n\r\n    @Override\r\n    public AdaptedMap marshal(Map&lt;String, Address&gt; map) throws Exception {\r\n        AdaptedMap adaptedMap = new AdaptedMap();\r\n        for(Map.Entry&lt;String, Address&gt; mapEntry : map.entrySet()) {\r\n            Entry entry = new Entry();\r\n            entry.key = mapEntry.getKey();\r\n            entry.value = mapEntry.getValue();\r\n            adaptedMap.entry.add(entry);\r\n        }\r\n        return adaptedMap;\r\n    }\r\n\r\n}<\/pre>\n<h4>Customer<\/h4>\n<p>The <i>@XmlJavaTypeAdapter<\/i> annotation is used to specify the <i>XmlAdapter<\/i> on the <i>Map<\/i> property. Note with an <i>XmlAdaper<\/i> applied we need to change the <i>@XmlElementWrapper<\/i> annotation to <i>@XmlElement <\/i>(evidence that <i>@XmlElement<\/i> should be used to annotate the element for a <i>Map<\/i> property).<\/p>\n<pre class=\" brush:java\">package blog.map;\r\n\r\nimport java.util.*;\r\nimport javax.xml.bind.annotation.*;\r\nimport javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;\r\n\r\n@XmlRootElement\r\npublic class Customer {\r\n\r\n    private Map&lt;String, Address&gt; addressMap = new HashMap&lt;String, Address&gt;();\r\n\r\n    @XmlJavaTypeAdapter(MapAdapter.class)\r\n    @XmlElement(name='addresses')\r\n    public Map&lt;String, Address&gt; getAddressMap() {\r\n        return addressMap;\r\n    }\r\n\r\n    public void setAddressMap(Map&lt;String, Address&gt; addressMap) {\r\n        this.addressMap = addressMap;\r\n    }\r\n\r\n}<\/pre>\n<h4>Output <\/h4>\n<p>Now all the elements in the XML output are qualfied with the <i>http:\/\/www.example.com <\/i>namespace.<\/p>\n<pre class=\" brush:xml\">&lt;?xml version='1.0' encoding='UTF-8'?&gt;\r\n&lt;customer xmlns='http:\/\/www.example.com'&gt;\r\n    &lt;addresses&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;shipping&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;street&gt;2 B Road&lt;\/street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n        &lt;entry&gt;\r\n            &lt;key&gt;billing&lt;\/key&gt;\r\n            &lt;value&gt;\r\n                &lt;street&gt;1 A Street&lt;\/street&gt;\r\n            &lt;\/value&gt;\r\n        &lt;\/entry&gt;\r\n    &lt;\/addresses&gt;\r\n&lt;\/customer&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p><b><i>Reference: <\/i><\/b><a href=\"http:\/\/blog.bdoughan.com\/2013\/03\/jaxb-and-javautilmap.html\">JAXB and java.util.Map<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Blaise Doughan at the <a href=\"http:\/\/blog.bdoughan.com\/\">Java XML &amp; JSON Binding<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much easier. Java Model Below is the Java model that we will use for this example. Customer The Customer class has a property of type Map . &hellip;<\/p>\n","protected":false},"author":51,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[144,107],"class_list":["post-9483","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jaxb","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JAXB and java.util.Map<\/title>\n<meta name=\"description\" content=\"Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JAXB and java.util.Map\" \/>\n<meta property=\"og:description\" content=\"Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-03-07T11:00:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Blaise Doughan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/bdoughan\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Blaise Doughan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html\"},\"author\":{\"name\":\"Blaise Doughan\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/aa63986b9b274cb85d2c6ea9d73bfda8\"},\"headline\":\"JAXB and java.util.Map\",\"datePublished\":\"2013-03-07T11:00:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html\"},\"wordCount\":525,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"JAXB\",\"XML\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html\",\"name\":\"JAXB and java.util.Map\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2013-03-07T11:00:29+00:00\",\"description\":\"Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/03\\\/jaxb-and-java-util-map.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"JAXB and java.util.Map\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/aa63986b9b274cb85d2c6ea9d73bfda8\",\"name\":\"Blaise Doughan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g\",\"caption\":\"Blaise Doughan\"},\"description\":\"Team lead for the TopLink\\\/EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.\",\"sameAs\":[\"http:\\\/\\\/blog.bdoughan.com\\\/\",\"http:\\\/\\\/ca.linkedin.com\\\/in\\\/bdoughan\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/twitter.com\\\/bdoughan\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/blaise-doughan\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JAXB and java.util.Map","description":"Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html","og_locale":"en_US","og_type":"article","og_title":"JAXB and java.util.Map","og_description":"Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much","og_url":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-03-07T11:00:29+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Blaise Doughan","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/bdoughan","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Blaise Doughan","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html"},"author":{"name":"Blaise Doughan","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/aa63986b9b274cb85d2c6ea9d73bfda8"},"headline":"JAXB and java.util.Map","datePublished":"2013-03-07T11:00:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html"},"wordCount":525,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["JAXB","XML"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html","url":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html","name":"JAXB and java.util.Map","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2013-03-07T11:00:29+00:00","description":"Is it ironic that it can be difficult to map the java.util.Map class in JAXB (JSR-222)? In this post I will cover some items that will make it much","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/03\/jaxb-and-java-util-map.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"JAXB and java.util.Map"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/aa63986b9b274cb85d2c6ea9d73bfda8","name":"Blaise Doughan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/375230a428542e375a6e404b30a2d5620afc3aadb16e21d1268227def78b3703?s=96&d=mm&r=g","caption":"Blaise Doughan"},"description":"Team lead for the TopLink\/EclipseLink JAXB &amp; SDO implementations, and the Oracle representative on those specifications.","sameAs":["http:\/\/blog.bdoughan.com\/","http:\/\/ca.linkedin.com\/in\/bdoughan","https:\/\/x.com\/http:\/\/twitter.com\/bdoughan"],"url":"https:\/\/www.javacodegeeks.com\/author\/blaise-doughan"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/9483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=9483"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/9483\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=9483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=9483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=9483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}