jaxb-ri
jaxb-ri copied to clipboard
Infer generic components for XmlAdapter
As discussed in http://forums.java.net/jive/thread.jspa?threadID=17972 .
XmlAdapter should be extended to support inference of the component types of the type it is annotated on. This would allow for creation of a single generic XmlAdapter, instead of creating separate XmlAdapters for each different set of component types. This most directly affects users of Map types to emulate Map functionality over SOAP.
e.g. instead of creating separate XmlAdapters for each different key-value type pair, one could create:
public class MapAdapter<K,V> extends XmlAdapter<MapEntity<K,V>[], Map<K,V>>
where MapEntity is a simple user class, consisting of a generic key and value field.
This sort of functionality could be further integrated to automatically make use of the MapEntity class (which I would be happy to provide, even though it's dead-simple) whenever a Map type is encountered. This would bring JAXB more in line with the existing vendor-specific SOAP Map functionality extensions that Axis2, PHP 5, and other utilize (they all, at last look, generally convert their map types into similar arrays of key-value entities).
Environment
Operating System: All Platform: All
Affected Versions
[2.0.3]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/234
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by [email protected]
@glassfishrobot Commented Was assigned to jaxb-issues
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-234